-
-
Save gbmele/1845c285f46de002c3ef97e4cca9cfd1 to your computer and use it in GitHub Desktop.
Micro TDD Prolog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% test predicate | |
test(Summary, Predicate) :- | |
string_concat('\n ', Summary, Buf), | |
string_concat(Buf, ' is running', Message), | |
write(Message), | |
call(Predicate), | |
write('\ndone.'). | |
% example | |
force(anakin, 9). | |
force(luke, 10). | |
stronger(X, Y) :- | |
force(X, FX), | |
force(Y, FY), | |
FX > FY. | |
test :- | |
test('anakin stronger', ( | |
stronger(anakin, luke) | |
)). | |
% run tests on compile | |
:- test. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment