Skip to content

Instantly share code, notes, and snippets.

@ibrahimsag
Last active December 17, 2015 21:59
Show Gist options
  • Save ibrahimsag/5678270 to your computer and use it in GitHub Desktop.
Save ibrahimsag/5678270 to your computer and use it in GitHub Desktop.
% add this line to somewhere in the source file
it:- it(Message, P), (call(P)-> write('\x1b[32;1mpassed\x1b[0m');write('\x1b[31;1mfailed\x1b[0m')), write(' '),write(Message), nl, fail.
% add ass many of this line as you need
% it('<message>', <expression>).
% expression is the thing you want to test that is supposed to be provable if your code works fine.
% message is the description of the thing you want to test..
it('Ayse is Ali's mother', mom(ayse, ali)).
it('Osman is not Ali's mother', \+ mom(osman, ali)).
% if your code works fine when you run 'it.' in query mode you should see
% passed Ayse is Ali's mother
% passed Osman is not Ali's mother
% otherwise
% failed Ayse is Ali's mother
% passed Osman is not Ali's mother
% with colors. everybody likes colors :D
% http://en.wikipedia.org/wiki/ANSI_escape_code for rainbows
% if you have shit to improve that would be great.
% prolog loves you :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment