Re: [Csnd-dev] Unit Testing
Hlöðver Sigurðsson <[email protected]>
| Newsgroups | gmane.comp.audio.csound.devel |
|---|---|
| Message-ID | <CAB8vR8+AFsMECPd9m0mziHprTSEkbwYJbRYg5V=ckDXjjXtYBA@mail.gmail.com> |
I made a similar PR for a built-in approach https://github.com/csound/csound/pull/1663 On Mon, 19 Feb 2024 at 21:48, Steven Yi <[email protected]> wrote: > 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 >