• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

2.2 Writing the test body
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • Prolog Unit Tests
        • A Unit Test box
          • Writing the test body
            • Testing deterministic predicates
            • Testing semi-deterministic predicates
            • Testing non-deterministic predicates
            • Testing error conditions
            • One body with multiple tests using assertions

2.2.3 Testing non-deterministic predicates

Non-deterministic predicates succeed zero or more times. Their results are tested either using findall/3 or setof/3 followed by a value-check or using the all or set options. The following are equivalent tests:

test(member) :-
        findall(X, member(X, [a,b,c]), Xs),
        Xs == [a,b,c].

test(member, all(X == [a,b,c])) :-
        member(X, [a,b,c]).

ClioPatria (version V3.1.1-51-ga0b30a5)