Skip to content

Commit d38300b

Browse files
align test input/output cases
1 parent d331079 commit d38300b

File tree

2 files changed

+29
-24
lines changed

2 files changed

+29
-24
lines changed

Sources/AtCoderLibrary/Command/New/Generator/Test.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ struct Test: Generator {
1414
import XCTest
1515
import TestLibrary
1616
17+
let cases: [TestCase] = [
18+
\(problem.tests.map(Self.testCase).joined(separator: "\n"))
19+
]
20+
1721
final class \(className): XCTestCase, TimeLimit {
1822
let timeLimit: TimeInterval = \(Double(problem.timeLimit)/1000)
1923
2024
func testExample() throws {
21-
let cases: [TestCase] = [
22-
\(problem.tests.map(Self.testCase).joined(separator: "\n"))
23-
]
2425
try cases.forEach(solve)
2526
}
2627
}
@@ -31,11 +32,12 @@ struct Test: Generator {
3132
let inputs = test.input.split(separator: "\n")
3233
let outputs = test.output.split(separator: "\n")
3334
return """
34-
(#filePath, #line, \"""
35-
\(inputs.map { " \($0)" }.joined(separator: "\n"))
36-
\""", \"""
37-
\(outputs.map { " \($0)" }.joined(separator: "\n"))
38-
\"""),
35+
(#filePath, #line,
36+
\"""
37+
\(inputs.map { "\($0)" }.joined(separator: "\n"))
38+
\""", \"""
39+
\(outputs.map { "\($0)" }.joined(separator: "\n"))
40+
\"""),
3941
"""
4042
}
4143
}

Tests/AtCoderLibraryTests/Command/New/Generator/TestTests.swift

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,29 @@ final class TestTests: XCTestCase {
2020
import XCTest
2121
import TestLibrary
2222
23+
let cases: [TestCase] = [
24+
(#filePath, #line,
25+
\"""
26+
10 2
27+
20 3
28+
30 4
29+
\""", \"""
30+
5
31+
20
32+
3
33+
\"""),
34+
(#filePath, #line,
35+
\"""
36+
199 2
37+
\""", \"""
38+
1992
39+
\"""),
40+
]
41+
2342
final class ATests: XCTestCase, TimeLimit {
2443
let timeLimit: TimeInterval = 2.0
2544
2645
func testExample() throws {
27-
let cases: [TestCase] = [
28-
(#filePath, #line, \"""
29-
10 2
30-
20 3
31-
30 4
32-
\""", \"""
33-
5
34-
20
35-
3
36-
\"""),
37-
(#filePath, #line, \"""
38-
199 2
39-
\""", \"""
40-
1992
41-
\"""),
42-
]
4346
try cases.forEach(solve)
4447
}
4548
}

0 commit comments

Comments
 (0)