25 lines
514 B
Plaintext
25 lines
514 B
Plaintext
' 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
|