Created
June 1, 2011 15:46
-
-
Save alecmce/1002592 to your computer and use it in GitHub Desktop.
I don't understand why one assert per test is superior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the code | |
class eg | |
{ | |
public var width:int; | |
public var height:int; | |
public function eg(width:int, height:int) | |
{ | |
this.width = width; | |
this.height = height; | |
} | |
public function clone():eg | |
{ | |
return new eg(width, height); | |
} | |
} | |
// this test tests clone. If this test fails, clone fails, if it passes, clone passes | |
[Test] | |
public function a_clone_is_the_same_size_as_its_parent():void | |
{ | |
a = new eg(123, 321); | |
b = a.clone(); | |
assertEquals(a.width, b.width); | |
assertEquals(a.height, b.height); | |
} | |
// these tests test clone. If either test fails, clone fails, if both pass, clone passes | |
[Test] | |
public function a_clone_is_the_same_width_as_its_parent():void | |
{ | |
a = new eg(123, 321); | |
b = a.clone(); | |
assertEquals(a.width, b.width); | |
} | |
[Test] | |
public function a_clone_is_the_same_height_as_its_parent():void | |
{ | |
a = new eg(123, 321); | |
b = a.clone(); | |
assertEquals(a.height, b.height); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment