Changes between Version 2 and Version 3 of Tests
- Timestamp:
- 01/24/17 21:25:56 (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Tests
v2 v3 5 5 Tests are specified as clauses on Class members (methods and properties) or on Class types(?). 6 6 7 They are given as an indented block of standalone code prefixed by the '''test''' keyword suffix with an optional test name .[[BR]]7 They are given as an indented block of standalone code prefixed by the '''test''' keyword suffix with an optional test name [http://cobra-language.com/forums/viewtopic.php?f=4&t=989 forum discussion].[[BR]] 8 8 The indented code block does the setup for a test (object instantiation and state initialisation), executes the test case (or cases), verifies ( usually by [wiki:Assert assertions]) that the test passes followed by any necessary teardown. 9 9 … … 47 47 .val += inc 48 48 return .val 49 50 class X 51 52 test fill 53 ml = MultiList<of int>(4, 3, 2).fill(5, [1, 2, 3, 4, 5, 6, 7, 8]) 54 assert ml.toString == ... 55 ml1 = MultiList<of Pair<of int>>([2, 2]).fill([Pair<of int>(0, 2), Pair<of int>(1, 3)]) 56 ml2 = MultiList<of Pair<of int>>([2, 2], [Pair<of int>(0, 2), Pair<of int>(1, 3)]) 57 assert ml1.equals(ml2) 58 59 test cloneAndTranspose 60 ml = MultiList<of int>([3, 4, 2], for i in 24 get i+3) 61 assert ml.clone.transpose.equals(ml.permute([2, 1, 0])) 62 49 63 }}} 50 64