From 018d9f6349c98e02a16fb90fc95f47a564b92fc4 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 9 Aug 2024 15:06:45 +0200 Subject: Add another test --- mintages/parser_test.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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 -- cgit v1.2.3