From cdf69113c20c1f77bf9bdf2b74362f597303e24b Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Wed, 25 Dec 2024 15:46:07 +0100 Subject: [PATCH] tests: speedup readersearch tests --- spec/unit/readersearch_spec.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/unit/readersearch_spec.lua b/spec/unit/readersearch_spec.lua index d9524350e..260d5e609 100644 --- a/spec/unit/readersearch_spec.lua +++ b/spec/unit/readersearch_spec.lua @@ -30,7 +30,7 @@ describe("Readersearch module", function() it("should search backward", function() rolling:onGotoPage(10) assert.truthy(search:searchFromCurrent("Verona", 1)) - for i = 1, 100, 10 do + for i = 1, 50, 10 do rolling:onGotoPage(i) local words = search:searchFromCurrent("Verona", 1) if words then @@ -45,7 +45,7 @@ describe("Readersearch module", function() it("should search forward", function() rolling:onGotoPage(10) assert.truthy(search:searchFromCurrent("Verona", 0)) - for i = 1, 100, 10 do + for i = 1, 50, 10 do rolling:onGotoPage(i) local words = search:searchFromCurrent("Verona", 0) if words then @@ -58,7 +58,7 @@ describe("Readersearch module", function() end end) it("should find the first occurrence", function() - for i = 10, 100, 10 do + for i = 10, 50, 10 do rolling:onGotoPage(i) local words = search:searchFromStart("Verona") assert.truthy(words) @@ -161,7 +161,7 @@ describe("Readersearch module", function() it("should search backward", function() paging:onGotoPage(20) assert.truthy(search:searchFromCurrent("test", 1)) - for i = 1, 40, 10 do + for i = 1, 15, 14 do paging:onGotoPage(i) local words = search:searchFromCurrent("test", 1) if words then @@ -173,7 +173,7 @@ describe("Readersearch module", function() it("should search forward", function() paging:onGotoPage(20) assert.truthy(search:searchFromCurrent("test", 0)) - for i = 1, 40, 10 do + for i = 1, 40, 39 do paging:onGotoPage(i) local words = search:searchFromCurrent("test", 0) if words then @@ -183,26 +183,26 @@ describe("Readersearch module", function() end end) it("should find the first occurrence", function() - for i = 20, 40, 10 do + for i = 20, 30, 10 do paging:onGotoPage(i) local words = search:searchFromStart("test") assert.truthy(words) assert.are.equal(10, words.page) end - for i = 1, 10, 2 do + for i = 1, 10, 9 do paging:onGotoPage(i) local words = search:searchFromStart("test") assert(words == nil) end end) it("should find the last occurrence", function() - for i = 10, 30, 10 do + for i = 10, 20, 10 do paging:onGotoPage(i) local words = search:searchFromEnd("test") assert.truthy(words) assert.are.equal(32, words.page) end - for i = 40, 50, 2 do + for i = 40, 45, 5 do paging:onGotoPage(i) local words = search:searchFromEnd("test") assert(words == nil)