Skip to content

Commit 4002758

Browse files
committed
[tests] basic min/max test cases
1 parent 6005588 commit 4002758

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/1_stdlib/Algorithm.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// RUN: %target-run-simple-swift
2+
// REQUIRES: executable_test
3+
4+
import StdlibUnittest
5+
import Swift
6+
7+
let AlgorithmTests = TestSuite("Algorithm")
8+
9+
AlgorithmTests.test("Min") {
10+
expectEqual(0, min(0, 1))
11+
expectEqual(0, min(1, 0))
12+
13+
expectEqual(0, min(0, 1, 1))
14+
expectEqual(0, min(1, 0, 1))
15+
expectEqual(0, min(1, 1, 0))
16+
}
17+
18+
AlgorithmTests.test("Max") {
19+
expectEqual(1, max(1, 0))
20+
expectEqual(1, max(0, 1))
21+
22+
expectEqual(1, max(1, 0, 0))
23+
expectEqual(1, max(0, 1, 0))
24+
expectEqual(1, max(0, 0, 1))
25+
}
26+
27+
runAllTests()

0 commit comments

Comments
 (0)