Natools

Check-in [a279720b94]
Login
Overview
Comment:s_expressions-templates-tests-dates: new test to show bad interaction between day-of-week and timezone
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a279720b94e2f63f87e02a374b93f94c4c2f632b
User & Date: nat on 2015-11-11 18:24:28
Other Links: manifest | tags
Context
2015-11-12
18:08
s_expressions-templates-dates: fix incorrect weekday w.r.t. time zone check-in: 57cb40c5fb user: nat tags: trunk
2015-11-11
18:24
s_expressions-templates-tests-dates: new test to show bad interaction between day-of-week and timezone check-in: a279720b94 user: nat tags: trunk
2015-08-27
17:45
constant_indefinite_ordered_map_tests: fix the test mistakenly trying to change a constant map check-in: 89c2a84e1b user: nat tags: trunk
Changes

Modified tests/natools-s_expressions-templates-tests-dates.adb from [6dbc93453b] to [1b97a3201a].

64
65
66
67
68
69
70

71
72
73
74
75
76
77
   begin
      Composite_Components (Report);
      Forced_Time_Zone (Report);
      Padded_Components (Report);
      RFC_3339 (Report);
      Simple_Components (Report);
      Static_Hash_Map (Report);

   end All_Tests;


   -----------------------
   -- Inidividual Tests --
   -----------------------








>







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
   begin
      Composite_Components (Report);
      Forced_Time_Zone (Report);
      Padded_Components (Report);
      RFC_3339 (Report);
      Simple_Components (Report);
      Static_Hash_Map (Report);
      Weekday_In_Time_Zone (Report);
   end All_Tests;


   -----------------------
   -- Inidividual Tests --
   -----------------------

242
243
244
245
246
247
248

































249
      if not Natools.Static_Maps.S_Expressions.Templates.Dates.T then
         Test.Fail;
      end if;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Static_Hash_Map;


































end Natools.S_Expressions.Templates.Tests.Dates;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
      if not Natools.Static_Maps.S_Expressions.Templates.Dates.T then
         Test.Fail;
      end if;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Static_Hash_Map;


   procedure Weekday_In_Time_Zone (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Week day in various time zones");
      Early : constant Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of
        (2015, 11, 11, 0, 29, 0, Time_Zone => 0);
      Late : constant Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of
        (2015, 11, 11, 23, 31, 0, Time_Zone => 0);
      Template_Prefix : constant String := "(in-zone ";
      Template_Suffix : constant String
        := " (day-of-week Monday Tuesday Wednesday"
         & " Thursday Friday Saturday Sunday) 1: "
         & " (day (suffix th (st 1 21 31) (nd 2 22) (rd 3 23))) 2:, "
         & " (hour) 1:: (padded-minute))";

      procedure Double_Test (Zone, Expected_Early, Expected_Late : String);

      procedure Double_Test (Zone, Expected_Early, Expected_Late : String) is
      begin
         Test_Render
           (Test, Template_Prefix & Zone & Template_Suffix,
            Expected_Early, Early);
         Test_Render
           (Test, Template_Prefix & Zone & Template_Suffix,
            Expected_Late, Late);
      end Double_Test;
   begin
      Double_Test ("0", "Wednesday 11th, 0:29", "Wednesday 11th, 23:31");
      Double_Test ("-01:00", "Tuesday 10th, 23:29", "Wednesday 11th, 22:31");
      Double_Test ("+01:00", "Wednesday 11th, 1:29", "Thursday 12th, 0:31");
   exception
      when Error : others => Test.Report_Exception (Error);
   end Weekday_In_Time_Zone;

end Natools.S_Expressions.Templates.Tests.Dates;

Modified tests/natools-s_expressions-templates-tests-dates.ads from [1343ad6815] to [1bf54a0b3c].

25
26
27
28
29
30
31

32
33

   procedure Composite_Components (Report : in out NT.Reporter'Class);
   procedure Forced_Time_Zone (Report : in out NT.Reporter'Class);
   procedure Padded_Components (Report : in out NT.Reporter'Class);
   procedure RFC_3339 (Report : in out NT.Reporter'Class);
   procedure Simple_Components (Report : in out NT.Reporter'Class);
   procedure Static_Hash_Map (Report : in out NT.Reporter'Class);


end Natools.S_Expressions.Templates.Tests.Dates;







>


25
26
27
28
29
30
31
32
33
34

   procedure Composite_Components (Report : in out NT.Reporter'Class);
   procedure Forced_Time_Zone (Report : in out NT.Reporter'Class);
   procedure Padded_Components (Report : in out NT.Reporter'Class);
   procedure RFC_3339 (Report : in out NT.Reporter'Class);
   procedure Simple_Components (Report : in out NT.Reporter'Class);
   procedure Static_Hash_Map (Report : in out NT.Reporter'Class);
   procedure Weekday_In_Time_Zone (Report : in out NT.Reporter'Class);

end Natools.S_Expressions.Templates.Tests.Dates;