2016-07-11 17:46:23 +00:00
|
|
|
package duration
|
|
|
|
|
2016-07-11 18:19:35 +00:00
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
)
|
2016-07-11 17:46:23 +00:00
|
|
|
|
|
|
|
func Test_ParseDurationSecond(t *testing.T) {
|
|
|
|
outp, err := ParseDurationSecond("9876s")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
2016-07-11 18:19:35 +00:00
|
|
|
if outp != time.Duration(9876)*time.Second {
|
2016-07-11 17:46:23 +00:00
|
|
|
t.Fatal("not equivalent")
|
|
|
|
}
|
|
|
|
outp, err = ParseDurationSecond("9876")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
2016-07-11 18:19:35 +00:00
|
|
|
if outp != time.Duration(9876)*time.Second {
|
2016-07-11 17:46:23 +00:00
|
|
|
t.Fatal("not equivalent")
|
|
|
|
}
|
|
|
|
}
|