|
1 | 1 | /*
|
2 | 2 | * This file is part of Arduino Builder.
|
3 | 3 | *
|
| 4 | + * Copyright 2016 Arduino LLC (http://www.arduino.cc/) |
| 5 | + * |
4 | 6 | * Arduino Builder is free software; you can redistribute it and/or modify
|
5 | 7 | * it under the terms of the GNU General Public License as published by
|
6 | 8 | * the Free Software Foundation; either version 2 of the License, or
|
|
23 | 25 | * the GNU General Public License. This exception does not however
|
24 | 26 | * invalidate any other reasons why the executable file might be covered by
|
25 | 27 | * the GNU General Public License.
|
26 |
| - * |
27 |
| - * Copyright 2015 Arduino LLC (http://www.arduino.cc/) |
28 | 28 | */
|
29 | 29 |
|
30 |
| -package test |
| 30 | +package timeutils |
31 | 31 |
|
32 | 32 | import (
|
33 | 33 | "testing"
|
34 | 34 | "time"
|
35 | 35 |
|
36 |
| - "arduino.cc/builder/utils" |
37 | 36 | "github.com/stretchr/testify/require"
|
38 | 37 | )
|
39 | 38 |
|
40 | 39 | func TestTime(t *testing.T) {
|
41 | 40 | loc, err := time.LoadLocation("CET")
|
42 |
| - NoError(t, err) |
| 41 | + require.NoError(t, err) |
43 | 42 |
|
44 | 43 | firstJanuary2015CET := time.Date(2015, 1, 1, 0, 0, 0, 0, loc)
|
45 | 44 | require.Equal(t, int64(1420066800), firstJanuary2015CET.Unix())
|
46 |
| - require.Equal(t, int64(1420066800+3600), utils.LocalUnix(firstJanuary2015CET)) |
47 |
| - require.Equal(t, 0, utils.DaylightSavingsOffset(firstJanuary2015CET)) |
| 45 | + require.Equal(t, int64(1420066800+3600), LocalUnix(firstJanuary2015CET)) |
| 46 | + require.Equal(t, 3600, TimezoneOffsetNoDST(firstJanuary2015CET)) |
| 47 | + require.Equal(t, 0, DaylightSavingsOffset(firstJanuary2015CET)) |
48 | 48 |
|
49 | 49 | fall2015CET := time.Date(2015, 9, 23, 0, 0, 0, 0, loc)
|
50 | 50 | require.Equal(t, int64(1442959200), fall2015CET.Unix())
|
51 |
| - require.Equal(t, int64(1442959200+3600+3600), utils.LocalUnix(fall2015CET)) |
52 |
| - require.Equal(t, 3600, utils.DaylightSavingsOffset(fall2015CET)) |
| 51 | + require.Equal(t, int64(1442959200+3600+3600), LocalUnix(fall2015CET)) |
| 52 | + require.Equal(t, 3600, TimezoneOffsetNoDST(fall2015CET)) |
| 53 | + require.Equal(t, 3600, DaylightSavingsOffset(fall2015CET)) |
53 | 54 | }
|
0 commit comments