From e0702237c385bc4ea5121c5640b885c018a45cd3 Mon Sep 17 00:00:00 2001 From: Stevan Andjelkovic Date: Mon, 23 Dec 2024 15:02:23 +0100 Subject: [PATCH] fix: python petserver parameter type --- example/petstore-python-flask/petstore.py | 4 ++-- src/Spex/Experiment/LinearTemporalLogic.hs | 5 ++--- src/Spex/Experiment/Protocol3.hs | 11 +++++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/example/petstore-python-flask/petstore.py b/example/petstore-python-flask/petstore.py index ebd6383..47fa0ca 100644 --- a/example/petstore-python-flask/petstore.py +++ b/example/petstore-python-flask/petstore.py @@ -7,13 +7,13 @@ # NOTE: Not thread-safe and won't work if clients connect concurrently. petstore = {} -@app.route("/pet/", methods=["GET"]) +@app.route("/pet/", methods=["GET"]) def get_pet(pet_id): if pet_id in petstore: pet_name = petstore[pet_id] return jsonify(petId=pet_id, petName=pet_name) else: - return "Pet not found", 404 + return jsonify(error="Pet not found"), 404 @app.route("/pet", methods=["POST"]) def add_pet(): diff --git a/src/Spex/Experiment/LinearTemporalLogic.hs b/src/Spex/Experiment/LinearTemporalLogic.hs index 78329c6..9149726 100644 --- a/src/Spex/Experiment/LinearTemporalLogic.hs +++ b/src/Spex/Experiment/LinearTemporalLogic.hs @@ -1,6 +1,4 @@ -module Spex.Experiment.LinearTemporalLogic - (module Spex.Experiment.LinearTemporalLogic) - where +module Spex.Experiment.LinearTemporalLogic (module Spex.Experiment.LinearTemporalLogic) where -- Bug Catching: Automated Program Verification: -- https://www.cs.cmu.edu/~15414/ @@ -8,6 +6,7 @@ module Spex.Experiment.LinearTemporalLogic -- NuSMV: https://www.cs.cmu.edu/~15414/lectures/21-ltl.pdf -- The algorithm used in the 2018 lectures: -- https://link.springer.com/content/pdf/10.1007/978-0-387-34892-6_1.pdf +-- https://en.wikipedia.org/wiki/Property_Specification_Language import Data.Maybe diff --git a/src/Spex/Experiment/Protocol3.hs b/src/Spex/Experiment/Protocol3.hs index ba54773..d0a14e9 100644 --- a/src/Spex/Experiment/Protocol3.hs +++ b/src/Spex/Experiment/Protocol3.hs @@ -389,11 +389,14 @@ test seed = do mapM_ (putStrLn . prettyEnvelope) (runSim sim) return False -t :: Int -> IO () -t 0 = putStrLn "Success!" -t numberOfTests = do +t' :: Int -> IO () +t' 0 = putStrLn "Success!" +t' numberOfTests = do seed <- randomIO passed <- test seed if passed - then t (numberOfTests - 1) + then t' (numberOfTests - 1) else return () + +t :: IO () +t = t' 100