noahshaw11 commented on a change in pull request #3766:
URL: https://github.com/apache/couchdb/pull/3766#discussion_r807285965



##########
File path: src/smoosh/test/smoosh_priority_queue_tests.erl
##########
@@ -0,0 +1,164 @@
+-module(smoosh_priority_queue_tests).
+
+-include_lib("proper/include/proper.hrl").
+-include_lib("couch/include/couch_eunit.hrl").
+
+-define(PROP_PREFIX, "prop_").
+
+-define(CAPACITY, 3).
+
+-define(RANDOM_FILE, lists:flatten(io_lib:format("~p", [erlang:timestamp()]))).
+
+setup() ->
+    Ctx = test_util:start_couch(),
+    Ctx.
+
+teardown(Ctx) ->
+    test_util:stop_couch(Ctx).
+
+smoosh_priority_queue_test_() ->
+    {
+        "smoosh priority queue test",
+        {
+            setup,
+            fun setup/0,
+            fun teardown/1,
+            [
+                fun prop_inverse_test_/0,
+                fun no_halt_on_corrupted_file_test/0,
+                fun no_halt_on_missing_file_test/0
+            ]
+        }
+    }.
+
+%% ==========
+%% Tests
+%% ----------
+
+%% define all tests to be able to run them individually
+prop_inverse_test_() ->
+    ?_test(begin
+        test_property(prop_inverse)
+    end).
+
+no_halt_on_corrupted_file_test() ->
+    ?_test(begin
+        Name = ?RANDOM_FILE,
+        Q = smoosh_priority_queue:new(Name),
+        FilePath = smoosh_priority_queue:file_name(Q),
+        ok = file:write_file(FilePath, <<"garbage">>),

Review comment:
       Added `?assertEqual(Q, smoosh_priority_queue:recover(Q))` which will be 
an empty queue in this case.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to