[DGD] Unit tests for LPC

nikoroleva natasha.i.koroleva at gmail.com
Sat Apr 27 01:03:07 CEST 2019


A few months ago I wrote some code for unit testing my LPC. It is
rudimentary, but it functions. I think the recent changes to
Continuations will be useful in a rewrite by making each test object a
Continuation and then chaining them all together which seems to
simplify everything about collecting them into an array and iterating.
I would probably change some other things knowing now what I know
after writing it, but it covers a thousand or so expectations in a
second or less; so not too bad I reckon.

I have not given much thought to this, but I wonder whether it guides
me into less than ideal patterns for which LPC is well suited. For
instance, if I cannot mock an inherited object, then I'll find another
way.

The experience also brought my lack of comprehending floats into sharp
focus. I try from time to time to learn them, but the things I read
seem to require more CS background and/or intuition than I possess.
The equality test works to several places, but it still feels a bit
hinky.

Writing a coverage reporter seems quite daunting as well.
cloud-server's LPC parser seems like a reasonable place to start, but
maybe it's something the interpreter is better suited for anyway,
particularly when it comes to code wrapped up in #directives. I have
no idea.

Either road, keeping my ambition within the bounds of my ability means
I look forward to experimenting with the new changes to the
Continuations lib someday soon and the unit testing code I have is a
decent use case for it. But it's not easy for me to stay inside when
the weather is nice.

How would you go about writing a framework for unit testing LPC code?


More information about the DGD mailing list