Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
danschultz
committed
Mar 7, 2011
1 parent
c935f9d
commit f15d146
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package mesh.core.number | ||
{ | ||
import mesh.core.object.inspect; | ||
|
||
import org.flexunit.assertThat; | ||
import org.hamcrest.object.equalTo; | ||
|
||
public class FractionTests | ||
{ | ||
[Test] | ||
public function testGCD():void | ||
{ | ||
var tests:Array = [ | ||
{a:1, b:2, expected:1}, | ||
{a:0, b:3, expected:3}, | ||
{a:3, b:0, expected:3}, | ||
{a:108, b:30, expected:6}, | ||
{a:-108, b:30, expected:6}, | ||
{a:108, b:-30, expected:6}, | ||
{a:-108, b:-30, expected:6} | ||
]; | ||
|
||
for each (var test:Object in tests) { | ||
assertThat("test failed: " + inspect(test), Fraction.gcd(test.a, test.b), equalTo(test.expected)); | ||
} | ||
} | ||
} | ||
} |