You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

misc_test.go 602B

1234567891011121314151617
  1. // Copyright (c) 2019 Shivaram Lingamneni <slingamn@cs.stanford.edu>
  2. // released under the MIT license
  3. package irc
  4. import (
  5. "testing"
  6. "time"
  7. )
  8. func TestZncTimestampParser(t *testing.T) {
  9. assertEqual(zncWireTimeToTime("1558338348.988"), time.Unix(1558338348, 988000000).UTC(), t)
  10. assertEqual(zncWireTimeToTime("1558338348.9"), time.Unix(1558338348, 900000000).UTC(), t)
  11. assertEqual(zncWireTimeToTime("1558338348"), time.Unix(1558338348, 0).UTC(), t)
  12. assertEqual(zncWireTimeToTime(".988"), time.Unix(0, 988000000).UTC(), t)
  13. assertEqual(zncWireTimeToTime("garbage"), time.Unix(0, 0).UTC(), t)
  14. }