-
Notifications
You must be signed in to change notification settings - Fork 0
/
HamcrestAssertTest.as
37 lines (33 loc) · 1.14 KB
/
HamcrestAssertTest.as
1
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
package {
import asunit.framework.TestCase;
import org.hamcrest.assertThat;
import org.hamcrest.core.describedAs;
import org.hamcrest.core.not;
import org.hamcrest.number.between;
import org.hamcrest.object.equalTo;
public class HamcrestAssertTest extends TestCase {
/**
* AsUnit detects function names beginning with 'test'.
*/
public function testBetweenInclusive() : void {
assertThat(3, between(2, 4));
assertThat(4, not(between(2, 3)));
assertThat("This is an intentional example of a failure:", 2.5, not(between(2, 3)));
}
/**
* Copied from org.hamcrest.object.IsEqualTest.as
* AsUnit detects non-static function names beginning with 'test'.
*/
public function testRecursivelyComparesElementsOfArrays() : void {
var i1 : Array = [[1, 2], [3, 4]];
var i2 : Array = [[1, 2], [3, 4]];
var i3 : Array = [[5, 6], [7, 8]];
var i4 : Array = [[1, 2, 3, 4], [3, 4]];
assertThat(i1, equalTo(i1));
assertThat(i2, equalTo(i1));
assertThat(i3, not(equalTo(i1)));
assertThat(i4, not(equalTo(i1)));
assertThat("This is an intentional example of a failure:", i4, equalTo(i1));
}
}
}