| Hi All,
While doing the pass-by-ref work, I experimented with writing some
assert UDOs. I found this worked out well, and suggest we spend a
little time to create a unit-testing .orc library to support our
unit-testing needs for orc code. Here are two example UDOs I put
together:
opcode assert(condition:b, message:S):void
if(!condition) then
prints(message)
exitnow(-1)
endif
endop
opcode assertEquals(ival, iexpected):void
if(ival != iexpected) then
prints("Error: ival was %g, expected %g\n", ival, iexpected)
exitnow(-1)
endif
endop
I suspect this would be good not-only as part of our tests but more
broadly for Csound users developing their own code. We could look at
having a separate repo for this and add it as a git submodule, or
perhaps some other approach. (Ideas welcome here.)
Cheers!
Steven |