1 // Copyright (c) 2013-2017 The btcsuite developers
2 // Use of this source code is governed by an ISC
3 // license that can be found in the LICENSE file.
13 // TestTimeSorter tests the timeSorter implementation.
14 func TestTimeSorter(t *testing.T) {
21 1351228575, // Fri Oct 26 05:16:15 UTC 2012 (Block #205000)
22 1348310759, // Sat Sep 22 10:45:59 UTC 2012 (Block #200000)
23 1305758502, // Wed May 18 22:41:42 UTC 2011 (Block #125000)
24 1347777156, // Sun Sep 16 06:32:36 UTC 2012 (Block #199000)
25 1349492104, // Sat Oct 6 02:55:04 UTC 2012 (Block #202000)
28 1305758502, // Wed May 18 22:41:42 UTC 2011 (Block #125000)
29 1347777156, // Sun Sep 16 06:32:36 UTC 2012 (Block #199000)
30 1348310759, // Sat Sep 22 10:45:59 UTC 2012 (Block #200000)
31 1349492104, // Sat Oct 6 02:55:04 UTC 2012 (Block #202000)
32 1351228575, // Fri Oct 26 05:16:15 UTC 2012 (Block #205000)
37 for i, test := range tests {
38 result := make([]int64, len(test.in))
40 sort.Sort(timeSorter(result))
41 if !reflect.DeepEqual(result, test.want) {
42 t.Errorf("timeSorter #%d got %v want %v", i, result,