From 814e4e4ad44a69ee751d47db7e2c67b6fd5dd2be Mon Sep 17 00:00:00 2001 From: Quang Le Date: Thu, 18 Jul 2019 10:37:23 +0700 Subject: [PATCH] Add test cases that make the endtoend test failed --- testdata/thresholdeq.go | 47 ++++++++++++++++++++++++++++++++++++++ testdata/thresholdgt.go | 50 +++++++++++++++++++++++++++++++++++++++++ testdata/thresholdlt.go | 44 ++++++++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+) create mode 100644 testdata/thresholdeq.go create mode 100644 testdata/thresholdgt.go create mode 100644 testdata/thresholdlt.go diff --git a/testdata/thresholdeq.go b/testdata/thresholdeq.go new file mode 100644 index 0000000..fd736b5 --- /dev/null +++ b/testdata/thresholdeq.go @@ -0,0 +1,47 @@ +package main + +import "fmt" + +type Thresholdeq int + +const ( + req1 Thresholdeq = 2 + req2 Thresholdeq = 4 + req3 Thresholdeq = 6 + req4 Thresholdeq = 8 + req5 Thresholdeq = 10 + req6 Thresholdeq = 12 + req7 Thresholdeq = 14 + req8 Thresholdeq = 16 + req9 Thresholdeq = 18 + req10 Thresholdeq = 20 +) + +func main() { + ck(1, "Thresholdeq(1)") + ck(req1, "req1") + ck(3, "Thresholdeq(3)") + ck(req2, "req2") + ck(5, "Thresholdeq(5)") + ck(req3, "req3") + ck(7, "Thresholdeq(7)") + ck(req4, "req4") + ck(9, "Thresholdeq(9)") + ck(req5, "req5") + ck(11, "Thresholdeq(11)") + ck(req6, "req6") + ck(13, "Thresholdeq(13)") + ck(req7, "req7") + ck(15, "Thresholdeq(15)") + ck(req8, "req8") + ck(17, "Thresholdeq(17)") + ck(req9, "req9") + ck(19, "Thresholdeq(19)") + ck(req10, "req10") +} + +func ck(thresholdeq Thresholdeq, str string) { + if fmt.Sprint(thresholdeq) != str { + panic("thresholdeq.go: " + str) + } +} diff --git a/testdata/thresholdgt.go b/testdata/thresholdgt.go new file mode 100644 index 0000000..88e589c --- /dev/null +++ b/testdata/thresholdgt.go @@ -0,0 +1,50 @@ +package main + +import "fmt" + +type Thresholdgt int + +const ( + rgt1 Thresholdgt = 2 + rgt2 Thresholdgt = 4 + rgt3 Thresholdgt = 6 + rgt4 Thresholdgt = 8 + rgt5 Thresholdgt = 10 + rgt6 Thresholdgt = 12 + rgt7 Thresholdgt = 14 + rgt8 Thresholdgt = 16 + rgt9 Thresholdgt = 18 + rgt10 Thresholdgt = 20 + rgt11 Thresholdgt = 22 +) + +func main() { + ck(1, "Thresholdgt(1)") + ck(rgt1, "rgt1") + ck(3, "Thresholdgt(3)") + ck(rgt2, "rgt2") + ck(5, "Thresholdgt(5)") + ck(rgt3, "rgt3") + ck(7, "Thresholdgt(7)") + ck(rgt4, "rgt4") + ck(9, "Thresholdgt(9)") + ck(rgt5, "rgt5") + ck(11, "Thresholdgt(11)") + ck(rgt6, "rgt6") + ck(13, "Thresholdgt(13)") + ck(rgt7, "rgt7") + ck(15, "Thresholdgt(15)") + ck(rgt8, "rgt8") + ck(17, "Thresholdgt(17)") + ck(rgt9, "rgt9") + ck(19, "Thresholdgt(19)") + ck(rgt10, "rgt10") + ck(21, "Thresholdgt(21)") + ck(rgt11, "rgt11") +} + +func ck(thresholdgt Thresholdgt, str string) { + if fmt.Sprint(thresholdgt) != str { + panic("thresholdgt.go: " + str) + } +} \ No newline at end of file diff --git a/testdata/thresholdlt.go b/testdata/thresholdlt.go new file mode 100644 index 0000000..603f382 --- /dev/null +++ b/testdata/thresholdlt.go @@ -0,0 +1,44 @@ +package main + +import "fmt" + +type Thresholdlt int + +const ( + rlt1 Thresholdlt = 2 + rlt2 Thresholdlt = 4 + rlt3 Thresholdlt = 6 + rlt4 Thresholdlt = 8 + rlt5 Thresholdlt = 10 + rlt6 Thresholdlt = 12 + rlt7 Thresholdlt = 14 + rlt8 Thresholdlt = 16 + rlt9 Thresholdlt = 18 +) + +func main() { + ck(1, "Thresholdlt(1)") + ck(rlt1, "rlt1") + ck(3, "Thresholdlt(3)") + ck(rlt2, "rlt2") + ck(5, "Thresholdlt(5)") + ck(rlt3, "rlt3") + ck(7, "Thresholdlt(7)") + ck(rlt4, "rlt4") + ck(9, "Thresholdlt(9)") + ck(rlt5, "rlt5") + ck(11, "Thresholdlt(11)") + ck(rlt6, "rlt6") + ck(13, "Thresholdlt(13)") + ck(rlt7, "rlt7") + ck(15, "Thresholdlt(15)") + ck(rlt8, "rlt8") + ck(17, "Thresholdlt(17)") + ck(rlt9, "rlt9") +} + +func ck(thresholdlt Thresholdlt, str string) { + if fmt.Sprint(thresholdlt) != str { + panic("thresholdlt.go: " + str) + } +}