Created
August 25, 2020 13:47
-
-
Save javierfernandes/2b461c0957da17b0cd489389dd791374 to your computer and use it in GitHub Desktop.
[RTT] interpreter test - declarative
This file contains hidden or 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
| describe('Boolean expressions', () => { | |
| [ | |
| // not | |
| { rule: 'not false', gives: true }, | |
| { rule: 'not true', gives: false }, | |
| { rule: 'not not true', gives: true }, | |
| // and | |
| { rule: 'true and true', gives: true }, | |
| { rule: 'true and false', gives: false }, | |
| { rule: 'false and true', gives: false }, | |
| { rule: 'false and false', gives: false }, | |
| // or | |
| { rule: 'true or false', gives: true }, | |
| { rule: 'true or true', gives: true }, | |
| { rule: 'false or true', gives: true }, | |
| { rule: 'false or false', gives: false }, | |
| // combinatory expressions | |
| { rule: 'it and true or false', it: true, gives: true }, | |
| { rule: 'x and y', having: { x: true, y: false }, gives: false }, | |
| { rule: 'not(x and y)', having: { x: true, y: false }, gives: true }, | |
| { rule: 'not not (x and y)', having: { x: true, y: false }, gives: false }, | |
| { rule: 'not (not x and y)', having: { x: true, y: false }, gives: true }, | |
| { rule: 'y or not x', having: { x: true, y: false }, gives: false }, | |
| { rule: 'x or y and z', having: { x: true, y: false, z: true }, gives: true }, | |
| { rule: 'x and (y or z)', having: { x: true, y: false, z: true }, gives: true }, | |
| { rule: '(x and y) or z', having: { x: true, y: false, z: true }, gives: true }, | |
| ].forEach(doTestEval) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment