Skip to content

Commit

Permalink
[test] refs #279 - Add test for ParseDate
Browse files Browse the repository at this point in the history
  • Loading branch information
e1Ru1o committed Dec 30, 2019
1 parent d9c840b commit 458b883
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/util/datetime_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package util

import (
"testing"
"time"

"github.com/stretchr/testify/require"
)

func TestParseDate(t *testing.T) {
some_date := int64(1577665665)
datetime := time.Unix(some_date, 0)

y, m, d := datetime.Date()
h, min, s := datetime.Hour(), datetime.Minute(), datetime.Second()

ny, nm, nd, nh, nmin, ns := ParseDate(some_date)
require.Equal(t, y, ny)
require.Equal(t, int(m), nm)
require.Equal(t, d, nd)
require.Equal(t, h, nh)
require.Equal(t, min, nmin)
require.Equal(t, s, ns)
}

0 comments on commit 458b883

Please sign in to comment.