Skip to content

Commit

Permalink
edition: Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
daenney committed Dec 11, 2020
1 parent 20a6001 commit 1d0365c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions edition_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package gdq

import (
"testing"
)

func TestEdition(t *testing.T) {
t.Run("latest", func(t *testing.T) {
assertEqual(t, Edition(0).String(), "latest")
})
t.Run("unknown", func(t *testing.T) {
assertEqual(t, Edition(^uint(0)).String(), "unknown edition: 18446744073709551615")
})
}

func TestGetEdition(t *testing.T) {
t.Run("empty", func(t *testing.T) {
_, ok := GetEdition("")
assertEqual(t, ok, false)
})
t.Run("unknown", func(t *testing.T) {
_, ok := GetEdition("AGDQ0")
assertEqual(t, ok, false)
})
t.Run("known", func(t *testing.T) {
e, ok := GetEdition("AgdQ2016")
assertEqual(t, ok, true)
assertEqual(t, e, AGDQ2016)
})
}

0 comments on commit 1d0365c

Please sign in to comment.