Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
martyall committed May 4, 2024
1 parent f12a49e commit fad0ead
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions factors/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,20 @@ import Test.QuickCheck
import ZK.Factors (Factors (..), Fr, factors)

main :: IO ()
main = do
main = hspec $ do
let circuit = factorsCircuit $ factors @Fr
vars = factorsVars $ factors @Fr
print circuit
print vars
hspec $ do
describe "Factors" $ do
it "should accept valid factors" $ do
property $
\x y ->
let inputs = assignInputs vars $ Map.fromList [("n", x * y), ("a", x), ("b", y)]
describe "Factors" $ do
it "should accept valid factors" $ do
property $
\x y ->
let inputs = assignInputs vars $ Map.fromList [("n", x * y), ("a", x), ("b", y)]
w = solve vars circuit inputs
in lookupVar vars "out" w === Just 1
it "shouldn't accept invalid factors" $ do
property $
\x y z ->
(x * y /= z) ==>
let inputs = assignInputs vars $ Map.fromList [("n", z), ("a", x), ("b", y)]
w = solve vars circuit inputs
in lookupVar vars "out" w === Just 1
it "shouldn't accept invalid factors" $ do
property $
\x y z ->
(x * y /= z) ==>
let inputs = assignInputs vars $ Map.fromList [("n", z), ("a", x), ("b", y)]
w = solve vars circuit inputs
in lookupVar vars "out" w == Just 0
in lookupVar vars "out" w == Just 0

0 comments on commit fad0ead

Please sign in to comment.