Loading extract/extract_test.go +22 −0 Original line number Diff line number Diff line Loading @@ -231,3 +231,25 @@ func TestXSquares(t *testing.T) { } } } func TestXTriangles(t *testing.T) { tests := []struct { title string url string xt int }{ {"test wrong input", "http://www.tg.c?xt=hello", 50}, {"test no input", "http://www.tg.c", 50}, {"test good input", "http://www.tg.c?xt=4", 4}, } for _, test := range tests { t.Log(test.title) r := &http.Request{Method: "GET"} r.URL, _ = url.Parse(test.url) xt := XTriangles(r) if xt != test.xt { t.Errorf("expected %d got %d", test.xt, xt) } } } Loading
extract/extract_test.go +22 −0 Original line number Diff line number Diff line Loading @@ -231,3 +231,25 @@ func TestXSquares(t *testing.T) { } } } func TestXTriangles(t *testing.T) { tests := []struct { title string url string xt int }{ {"test wrong input", "http://www.tg.c?xt=hello", 50}, {"test no input", "http://www.tg.c", 50}, {"test good input", "http://www.tg.c?xt=4", 4}, } for _, test := range tests { t.Log(test.title) r := &http.Request{Method: "GET"} r.URL, _ = url.Parse(test.url) xt := XTriangles(r) if xt != test.xt { t.Errorf("expected %d got %d", test.xt, xt) } } }