Can you check my strings in println, please? (println "dnf(1 & x) = x") (test/is (= (dnf…
- User
Can you check my strings in println, please? (println "dnf(1 & x) = x") (test/is (= (dnf (AND (constant 1) (variable :x))) (variable :x)))
(println "dnf(0 & x) = 0") (test/is (= (dnf (AND (constant 0) (variable :x))) (constant 0))) (println "dnf(1 | y) = 1") (test/is (= (dnf (OR (constant 1) (variable :y))) (constant 1))) (println "dnf(0 | y) = y") (test/is (= (dnf (OR (constant 0) (variable :y))) (variable :y))) - Assistant
Your
printlnstatements appear to be correctly formatted for outputting the test cases. They are also properly positioned before eachtest/isassertion to document the intent of each test case clearly. Here’s a review of your strings within theprintlnstatements:-
First Line:
(println "dnf(1 & x) = x")This is correct as you are stating the expected outcome of the DNF function when fed
(AND (constant 1) (variable :x)). -
Second Line:
(println "dnf(0 & x) = 0")This is also correct. It matches the expected output of DNF for
(AND (constant 0) (variable :x)). -
Third Line:
(println "dnf(1 | y) = 1")This statement is clear and accurately reflects the expectation of DNF for .
-
- User
Can you check others? (println "dnf(x -> y) = ~x | y") (test/is (= (dnf (IMPL (variable :x) (variable :y))) (OR (NOT (variable :x)) (variable :y))))
(println "dnf(0 | y) = y") (test/is (= (dnf (NOT (OR (OR (NOT (variable :x)) (variable :y)) (NOT (IMPL (variable :y) (variable :z)))))) (OR (AND (variable :x) (NOT (variable :y))) (AND (variable :x) (NOT (variable :y)) (variable :z))))) (println "dnf(0 | y) = y") (test/is (= (dnf (IMPL (IMPL (NOT (variable :x)) (NOT (variable :y))) (IMPL (AND (variable :y) (variable :z)) (AND (NOT (variable :x)) (variable :z))))) (OR (NOT (variable :y)) (NOT (variable :z)) (AND (NOT (variable :x)) (variable :z)) (NOT (variable :x))))) (println "dnf(0 | y) = y") (test/is (= (dnf (OR (variable :x) (IMPL (variable :y) (AND (variable :y) (variable :x))))) (OR (variable :x) (NOT (variable :y)) (AND (variable :y) (variable :x))))) - Assistant
Let's review your
printlnstatements and the associated logical tests for correctness and clarity:-
First Line:
-