From 2463c856fa2fe7cc4cf99ac57d261313ff7cdbbb Mon Sep 17 00:00:00 2001 From: InfiniteSwerve Date: Fri, 2 Dec 2022 13:31:16 -0800 Subject: [PATCH] adds 200k block load test --- .../tests/block_storage_tests.ml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/deku-p/src/core/block_storage/tests/block_storage_tests.ml b/deku-p/src/core/block_storage/tests/block_storage_tests.ml index 3ee76d91c..d33f824fc 100644 --- a/deku-p/src/core/block_storage/tests/block_storage_tests.ml +++ b/deku-p/src/core/block_storage/tests/block_storage_tests.ml @@ -112,6 +112,24 @@ let test_empty_block_and_votes env () = Eio.Switch.fail sw Test_finished with _ -> () +let test_200k_block_load env () = + try + Eio.Switch.run @@ fun sw -> + let block_storage = make_block_storage env sw in + let (Block { hash; _ } as block) = block ~default_block_size:200_000 in + Block_storage.save_block ~block block_storage; + let retrieved_block = + match Block_storage.find_block_by_hash ~block_hash:hash block_storage with + | Some block -> block + | None -> Genesis.block + in + Alcotest.(check' block_testable) + ~msg:"hash loaded block is equal to saved block" ~expected:block + ~actual:retrieved_block; + + Eio.Switch.fail sw Test_finished + with _ -> () + let run () = Eio_main.run (fun env -> let open Alcotest in @@ -123,6 +141,8 @@ let run () = (test_empty_block_load env); test_case "empty block and one vote is returned" `Quick (test_empty_block_and_votes env); + test_case "200k_block is returned" `Slow + (test_200k_block_load env); ] ); ])