Wiki

Changes between Version 2 and Version 3 of Tests

Show
Ignore:
Timestamp:
01/24/17 21:25:56 (8 years ago)
Author:
torial
Comment:

Added link to forum discussion on test naming, and example of naming.

Legend:

Unmodified
Added
Removed
Modified
  • Tests

    v2 v3  
    55Tests are specified as clauses on Class members (methods and properties) or on Class types(?). 
    66 
    7 They are given as an indented block of standalone code prefixed by the '''test''' keyword suffix with an optional test name.[[BR]] 
     7They 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]] 
    88The 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. 
    99 
     
    4747           .val += inc 
    4848           return .val  
     49 
     50class 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 
    4963}}} 
    5064