Index: tests/natools-cron-tests.adb ================================================================== --- tests/natools-cron-tests.adb +++ tests/natools-cron-tests.adb @@ -56,27 +56,19 @@ begin S.Size := 0; end Reset; - procedure Check - (Test : in out NT.Test; - Found : in Bounded_String; - Expected : in String; - Context : in String := "") is - begin - if Get (Found) /= Expected then - if Context /= "" then - Test.Fail (Context - & ": found """ & Get (Found) & """, expected """ - & Expected & '"'); - else - Test.Fail ("Found """ & Get (Found) & """, expected """ - & Expected & '"'); - end if; - end if; - end Check; + + ----------------- + -- Test Helper -- + ----------------- + + function Quote (Data : String) return String + is ('"' & Data & '"'); + + procedure Check is new NT.Generic_Check (String, "=", Quote, False); ------------------------- -- Complete Test Suite -- @@ -150,11 +142,11 @@ -- Beat: set at 4.5, finalized at 9.5, run at 5.0, 6.0, 7.0, 8.0, 9.0. -- Slow: set at 4.5, finalized at 9.5, run at 6.5, 8.5. -- Fast: set at 6.5, reset at 8.0, -- run at 6.7, 6.9, 7.1, 7.3, 7.5, 7.7, 7.9 - Check (Test, Log, ".1.1.1.|..sff.fffff.s."); + Check (Test, Get (Log), ".1.1.1.|..sff.fffff.s."); exception when Error : others => Test.Report_Exception (Error); end Basic_Usage; @@ -172,13 +164,13 @@ Close => ')', Wait => Total / 4)); delay Total / 4; end; - Check (Test, Log, "(", "Before wait"); + Check (Test, Get (Log), "(", "Before wait"); delay Total / 2; - Check (Test, Log, "()", "After wait"); + Check (Test, Get (Log), "()", "After wait"); exception when Error : others => Test.Report_Exception (Error); end Delete_While_Busy; @@ -212,11 +204,11 @@ -- Finalize: * -- Ticks: L L S L S L S L S L -- Run: <----L---->S <----L---->S <----L----> delay Total / 8; - Check (Test, Log, "().().()"); + Check (Test, Get (Log), "().().()"); exception when Error : others => Test.Report_Exception (Error); end Insert_While_Busy; @@ -239,11 +231,11 @@ ((Origin => Common.Origin, Period => 2 * Common.Period), Test_Callback'(Backend => Log'Access, Symbol => '3')); delay Total - Tick / 2; end; - Check (Test, Log, "12312123"); + Check (Test, Get (Log), "12312123"); exception when Error : others => Test.Report_Exception (Error); end Time_Collision; end Natools.Cron.Tests; Index: tests/natools-cron-tests.ads ================================================================== --- tests/natools-cron-tests.ads +++ tests/natools-cron-tests.ads @@ -40,16 +40,10 @@ procedure Append (S : in out Bounded_String; C : Character); function Get (S : Bounded_String) return String; procedure Reset (S : in out Bounded_String); - procedure Check - (Test : in out NT.Test; - Found : in Bounded_String; - Expected : in String; - Context : in String := ""); - type Test_Callback (Backend : access Bounded_String) is new Callback with record Symbol : Character; end record;