Hello, since I just found out, how easy it is, to write test cases and run them, I thought I'd share a few lines on this. Matthias: feel free to add this to the cookbook.
So you want to write test cases for you new function? Load lib/ans94/core/postpone.frt lib/ans94/core-ext/marker.frt they will be needed. The tester uses 4 words: TESTING add your comment here is a "talking comment" to make the output somehow look nice. { starts a new test. Prepare the stack and call your function, then -> indicates that the test code is complete. Add the remaining stack after this word. } completes the test by comparing the stack with the expected stack. If everything is well, the ok prompt will appear. A test summary is not printed, but that could Write a file with your new library function, e.g. \ function.frt \ define some new function : plus + ; Then write the test cases, e.g. \ function-test.frt \ load the tester include lib/ans94/tester/tester-amforth.frt \ load the code under test include function.frt \ run the tests TESTING the tester ----------------------------------------- { 1 1 + -> 2 } { 1 1 plus -> 2 } { 1 1 plus -> 3 } \ incorrect { 1 2 plus -> 3 } \ tester contiues { $FFFF 1 plus -> 0 } { 1 2 3 4 plus -> 1 2 7 } Now load the file 'function-test.frt' to the controller and watch the show. TESTING the tester ----------------------------------------- ok > { 1 1 + -> 2 } ok > { 1 1 plus -> 2 } ok > { 1 1 plus -> 3 } INCORRECT RESULT: { 1 1 plus -> 3 } ok > { 1 2 plus -> 3 } ok > { $FFFF 1 plus -> 0 } ok ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel