Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Assertions/BaCon/assertions.bacon
Normal file
24
Task/Assertions/BaCon/assertions.bacon
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
' Assertions
|
||||
answer = assertion(42)
|
||||
PRINT "The ultimate answer is indeed ", answer
|
||||
|
||||
PRINT "Now, expect a failure, unless NDEBUG defined at compile time"
|
||||
answer = assertion(41)
|
||||
PRINT answer
|
||||
END
|
||||
|
||||
' Ensure the given number is the ultimate answer
|
||||
FUNCTION assertion(NUMBER i)
|
||||
|
||||
' BaCon can easily be intimately integrated with C
|
||||
USEH
|
||||
#include <assert.h>
|
||||
END USEH
|
||||
|
||||
' If the given expression is not true, abort the program
|
||||
USEC
|
||||
assert(i == 42);
|
||||
END USEC
|
||||
|
||||
RETURN i
|
||||
END FUNCTION
|
||||
Loading…
Add table
Add a link
Reference in a new issue