// Cross-platform C solution test suite. // $CC is supplied by CI matrix (gcc / clang / msvc). // // Run locally: // CC=gcc judge sum.jdg . // CC=clang judge sum.jdg . // // On Windows, build_windows branches on CC because MSVC's cl has a // different CLI from clang. Executed via `cmd /C`, so %VAR% is cmd syntax. build "$CC -O2 -std=c11 -Wall -Wextra solution.c -o solution" build_windows "if /I \"%CC%\"==\"msvc\" (cl /nologo /O2 /W3 solution.c /Fe:solution.exe) else (%CC% -O2 -std=c11 -Wall -Wextra solution.c -o solution.exe)" binary = "solution" timeout 5s // Windows printf emits \r\n; normalize so tests are portable. normalize_crlf = true trim_trailing_ws = true group("basic") { weight = 0.4 timeout = 2s test("one number") { stdin = "1\n42\n" stdout = "42\n" } test("three numbers") { stdin = "3\n1 2 3\n" stdout = "6\n" } test("negatives") { stdin = "4\n-1 -2 3 5\n" stdout = "5\n" } test("zero count") { stdin = "0\n" stdout = "0\n" } } group("edge") { weight = 0.3 test("large sum fits in int64") { stdin = "3\n2000000000 2000000000 2000000000\n" stdout = "6000000000\n" } test("multiline input") { stdin = """ 5 10 20 30 40 50 """ stdout = "150\n" } } group("stress") { weight = 0.3 timeout = 3s scoring = all_or_none test("sum of 1..100") { stdin = "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\n" stdout = "5050\n" } }