Skip to content

Instantly share code, notes, and snippets.

@alecmce
Created June 1, 2011 15:46
Show Gist options
  • Save alecmce/1002592 to your computer and use it in GitHub Desktop.
Save alecmce/1002592 to your computer and use it in GitHub Desktop.
I don't understand why one assert per test is superior
// 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