From a1e63a0084b7e8a6a6323287c9b0c0ab4a00b43b Mon Sep 17 00:00:00 2001 From: Tomas Bareikis Date: Thu, 14 Sep 2023 09:01:08 +0300 Subject: [PATCH] Round 2 of test cases --- main_test.go | 28 ++++++++++++++++++++++++++++ tests/bigfoot/expected.txt | 1 + tests/bigfoot/in.txt | 1 + tests/emoji/expected.txt | 2 ++ tests/emoji/in.txt | 2 ++ tests/hehe/expected.txt | 2 ++ tests/hehe/in.txt | 2 ++ tests/rounding/expected.txt | 2 ++ tests/rounding/in.txt | 2 ++ tests/space/expected.txt | 2 ++ tests/space/in.txt | 3 +++ 11 files changed, 47 insertions(+) create mode 100644 tests/bigfoot/expected.txt create mode 100644 tests/bigfoot/in.txt create mode 100644 tests/emoji/expected.txt create mode 100644 tests/emoji/in.txt create mode 100644 tests/hehe/expected.txt create mode 100644 tests/hehe/in.txt create mode 100644 tests/rounding/expected.txt create mode 100644 tests/rounding/in.txt create mode 100644 tests/space/expected.txt create mode 100644 tests/space/in.txt diff --git a/main_test.go b/main_test.go index 0325229..ffaf26e 100644 --- a/main_test.go +++ b/main_test.go @@ -47,6 +47,34 @@ func doTest(tc *testCase) func(*testing.T) { } } +func TestBig(t *testing.T) { + lang := os.Getenv("LANGUAGE") + + team1 := "HEHE1 50 " + team2 := "HEHE2 51 " + team3 := "HEHE3 52 " + + steps := strings.Repeat("1000 ", 1000000) + + in := "" + in += team1 + steps + "\n" + in += team2 + steps + "\n" + in += team3 + steps + "\n" + + out, err := script.Echo(in).Exec("./run-" + lang + ".sh").String() + assert.NoError(t, err) + + expected := `HEHE1 1 500000.00 +HEHE2 1 510000.00 +HEHE3 1 520000.00` + + assert.Equal( + t, + strings.TrimSpace(expected), + strings.TrimSpace(out), + ) +} + func run(inFile string) (string, error) { lang := os.Getenv("LANGUAGE") return script.File(inFile).Exec("./run-" + lang + ".sh").String() diff --git a/tests/bigfoot/expected.txt b/tests/bigfoot/expected.txt new file mode 100644 index 0000000..d249503 --- /dev/null +++ b/tests/bigfoot/expected.txt @@ -0,0 +1 @@ +IAMHUGE 1 0.15 diff --git a/tests/bigfoot/in.txt b/tests/bigfoot/in.txt new file mode 100644 index 0000000..e8a0545 --- /dev/null +++ b/tests/bigfoot/in.txt @@ -0,0 +1 @@ +IAMHUGE 5023 1 1 1 diff --git a/tests/emoji/expected.txt b/tests/emoji/expected.txt new file mode 100644 index 0000000..8869a86 --- /dev/null +++ b/tests/emoji/expected.txt @@ -0,0 +1,2 @@ +HEHE💀☠️ 1 3.50 +FIRE🔥🔥🔥🔥 1 5.00 diff --git a/tests/emoji/in.txt b/tests/emoji/in.txt new file mode 100644 index 0000000..e9678c4 --- /dev/null +++ b/tests/emoji/in.txt @@ -0,0 +1,2 @@ +HEHE💀☠️ 100 1500 2000 +FIRE🔥🔥🔥🔥 100 2000 3000 diff --git a/tests/hehe/expected.txt b/tests/hehe/expected.txt new file mode 100644 index 0000000..fe4cf56 --- /dev/null +++ b/tests/hehe/expected.txt @@ -0,0 +1,2 @@ +ẖ̵̢̛̩͔̪̭̬̲̮̤̆͜͜e̵̡̬͙̥̖̹͈̞̲̞̻̜̾̂̅͐̎͒̔̕͝͝ĥ̶̢̛̳͕̠̳̥͉̩͂̎̓́̆̍̿́͐͆̓͠͝ͅè̷̡͖̬̘̹͇̼͑̔̓̾̋͌̔͑̿ 1 3.50 +ẘ̶̢̛̜̖͕͖̈̔͂̂̈̐̏̋͠h̴̜̫̰͚͎͍̲̗͙̓̅̇̈̃ͅͅa̵̬͕̕t̶͔̺̼̬̠͂̏̃̈́̓͗͂́͝͝i̸̥͙͔̮̝̰̪̤̹̅̒͜͜s̴̢̹̙̹̺̪̠̱̪̩̳͒ţ̵̡̺̣͚̬̲̺̹͕̜̘̼͍̪͐̉̊̌́̉̇̔͊̃̑̕͝͝͝ḩ̷̨͙̠̝̙̪̰̜̻̟̻͕͇͌̉̈́͛̚ị̴̢̬̠́s̶̨͎̘̳̦̠̮͓͒̿́͐̊́̀̾̽̎͠ 1 5.00 diff --git a/tests/hehe/in.txt b/tests/hehe/in.txt new file mode 100644 index 0000000..6d67f0f --- /dev/null +++ b/tests/hehe/in.txt @@ -0,0 +1,2 @@ +ẖ̵̢̛̩͔̪̭̬̲̮̤̆͜͜e̵̡̬͙̥̖̹͈̞̲̞̻̜̾̂̅͐̎͒̔̕͝͝ĥ̶̢̛̳͕̠̳̥͉̩͂̎̓́̆̍̿́͐͆̓͠͝ͅè̷̡͖̬̘̹͇̼͑̔̓̾̋͌̔͑̿ 100 1500 2000 +ẘ̶̢̛̜̖͕͖̈̔͂̂̈̐̏̋͠h̴̜̫̰͚͎͍̲̗͙̓̅̇̈̃ͅͅa̵̬͕̕t̶͔̺̼̬̠͂̏̃̈́̓͗͂́͝͝i̸̥͙͔̮̝̰̪̤̹̅̒͜͜s̴̢̹̙̹̺̪̠̱̪̩̳͒ţ̵̡̺̣͚̬̲̺̹͕̜̘̼͍̪͐̉̊̌́̉̇̔͊̃̑̕͝͝͝ḩ̷̨͙̠̝̙̪̰̜̻̟̻͕͇͌̉̈́͛̚ị̴̢̬̠́s̶̨͎̘̳̦̠̮͓͒̿́͐̊́̀̾̽̎͠ 100 2000 3000 diff --git a/tests/rounding/expected.txt b/tests/rounding/expected.txt new file mode 100644 index 0000000..9d35d2c --- /dev/null +++ b/tests/rounding/expected.txt @@ -0,0 +1,2 @@ +ROUNDDOWN 1 0.09 +ROUNDUP 1 0.10 diff --git a/tests/rounding/in.txt b/tests/rounding/in.txt new file mode 100644 index 0000000..a9fb352 --- /dev/null +++ b/tests/rounding/in.txt @@ -0,0 +1,2 @@ +ROUNDDOWN 100 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 1 1 1 1 1 +ROUNDUP 100 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 diff --git a/tests/space/expected.txt b/tests/space/expected.txt new file mode 100644 index 0000000..a2acffa --- /dev/null +++ b/tests/space/expected.txt @@ -0,0 +1,2 @@ +SPAAACE 2 8.50 +WOWSUCHEMPTY 1 5.00 diff --git a/tests/space/in.txt b/tests/space/in.txt new file mode 100644 index 0000000..ba399dc --- /dev/null +++ b/tests/space/in.txt @@ -0,0 +1,3 @@ +SPAAACE 55 4500 4200 +SPAAACE 56 4300 2333 +WOWSUCHEMPTY 50 1 10000