Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge remote-tracking branch 'upstream/master'

  • Loading branch information...
commit f0276947a7a230ceafd657bd5e8de9567f547a47 2 parents 6a79e15 + d0413a3
Paolo Donadeo authored

Showing 1 changed file with 45 additions and 40 deletions. Show diff stats Hide diff stats

  1. +45 40 src/test/testDate.ml
85 src/test/testDate.ml
@@ -2,69 +2,74 @@ open OUnit
2 2
3 3 let test_to_string () =
4 4 let t = {
5   - Netdate.year = 2011;
6   - month = 10;
7   - day = 14;
8   - hour = 10;
9   - minute = 30;
10   - second = 0;
11   - zone = 120;
12   - week_day = -1 } in
13   - let s = GapiDate.to_string t in
14   - assert_equal "2011-10-14T10:30:00.000+02:00" s
15   -
16   -let test_of_string () =
17   - let t = GapiDate.of_string "2011-10-14T10:30:00.000+02:00" in
18   - assert_equal
19   - { Netdate.year = 2011;
  5 + GapiDate.epoch with
  6 + Netdate.year = 2011;
20 7 month = 10;
21 8 day = 14;
22 9 hour = 10;
23 10 minute = 30;
24 11 second = 0;
25 12 zone = 120;
26   - week_day = -1 }
  13 + } in
  14 + let s = GapiDate.to_string t in
  15 + assert_equal "2011-10-14T10:30:00.000+02:00" s
  16 +
  17 +let test_of_string () =
  18 + let t = GapiDate.of_string "2011-10-14T10:30:00.000+02:00" in
  19 + assert_equal
  20 + { GapiDate.epoch with
  21 + Netdate.year = 2011;
  22 + month = 10;
  23 + day = 14;
  24 + hour = 10;
  25 + minute = 30;
  26 + zone = 120;
  27 + week_day = -1;
  28 + }
27 29 t
28 30
29 31 let test_of_string_negative_offset () =
30 32 let t = GapiDate.of_string "2011-10-14T10:30:00.000-02:00" in
31 33 assert_equal
32   - { Netdate.year = 2011;
33   - month = 10;
34   - day = 14;
35   - hour = 10;
36   - minute = 30;
37   - second = 0;
38   - zone = -120;
39   - week_day = -1 }
  34 + { GapiDate.epoch with
  35 + Netdate.year = 2011;
  36 + month = 10;
  37 + day = 14;
  38 + hour = 10;
  39 + minute = 30;
  40 + zone = -120;
  41 + week_day = -1;
  42 + }
40 43 t
41 44
42 45 let test_of_string_utc () =
43 46 let t = GapiDate.of_string "2011-10-14T10:30:00.000Z" in
44 47 assert_equal
45 48 ~printer:GapiDate.to_string
46   - { Netdate.year = 2011;
47   - month = 10;
48   - day = 14;
49   - hour = 10;
50   - minute = 30;
51   - second = 0;
52   - zone = 0;
53   - week_day = -1 }
  49 + { GapiDate.epoch with
  50 + Netdate.year = 2011;
  51 + month = 10;
  52 + day = 14;
  53 + hour = 10;
  54 + minute = 30;
  55 + second = 0;
  56 + week_day = -1;
  57 + }
54 58 t
55 59
56 60 let test_of_string_full_date () =
57 61 let t = GapiDate.of_string "2011-10-14" in
58 62 assert_equal
59 63 ~printer:GapiDate.to_string
60   - { Netdate.year = 2011;
61   - month = 10;
62   - day = 14;
63   - hour = 0;
64   - minute = 0;
65   - second = 0;
66   - zone = 0;
67   - week_day = -1 }
  64 + { GapiDate.epoch with
  65 + Netdate.year = 2011;
  66 + month = 10;
  67 + day = 14;
  68 + hour = 0;
  69 + minute = 0;
  70 + second = 0;
  71 + week_day = -1;
  72 + }
68 73 t
69 74
70 75 let suite = "Date test" >:::

0 comments on commit f027694

Please sign in to comment.
Something went wrong with that request. Please try again.