diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-08-09 15:06:45 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-08-09 15:06:45 +0200 |
commit | 018d9f6349c98e02a16fb90fc95f47a564b92fc4 (patch) | |
tree | 2722fbf6a2a710a56c33836442bea902ba80b2b7 | |
parent | 8a945da2cf0b2634305a9df88b0711f44968d0af (diff) |
Add another test
-rw-r--r-- | mintages/parser_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/mintages/parser_test.go b/mintages/parser_test.go index d186b7a..9ff4bc5 100644 --- a/mintages/parser_test.go +++ b/mintages/parser_test.go @@ -90,6 +90,35 @@ func TestParserComplete(t *testing.T) { } } +func TestParserNoProof(t *testing.T) { + data, err := parse(bytes.NewBuffer([]byte(` + BEGIN 2020 + BEGIN CIRC + 1.000 1001 1002 1003 1004 1005 1006 1007 + 2000 ? 2002 2003 2004 2005 2006 2007 + BEGIN BU + 1.100 1101 1102 1103 1104 1105 1106 1107 + 2100 ? 2102 2103 2104 2105 2106 2107 + `)), "-") + + if err != nil { + t.Fatalf(`Expected err=nil; got "%s"`, err) + } + + for _, row := range data.Proof { + for _, col := range row { + if col != -1 { + t.Fatalf("Expected data.Proof[i][j]=-1; got %d", col) + } + } + } + + rowsWant := time.Now().Year() - data.StartYear + 1 + if len(data.Proof) != rowsWant { + t.Fatalf("Expected len(data.Proof)=%d; got %d", rowsWant, len(data.Proof)) + } +} + func TestParserNoYear(t *testing.T) { _, err := parse(bytes.NewBuffer([]byte(` BEGIN CIRC |