samples/composition/src-test/org/apidesign/math/test/FactorialTest.java
changeset 407 e1439046d96e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/samples/composition/src-test/org/apidesign/math/test/FactorialTest.java	Sun Oct 06 22:05:14 2013 +0200
     1.3 @@ -0,0 +1,44 @@
     1.4 +/*
     1.5 + * Žluťoučký kůň je naše hříbátko.
     1.6 + * and open the template in the editor.
     1.7 + */
     1.8 +
     1.9 +package org.apidesign.math.test;
    1.10 +
    1.11 +import junit.framework.TestCase;
    1.12 +
    1.13 +/**
    1.14 + *
    1.15 + * @author Jaroslav Tulach <jtulach@netbeans.org>
    1.16 + */
    1.17 +public class FactorialTest extends TestCase {
    1.18 +    
    1.19 +    public FactorialTest(String testName) {
    1.20 +        super(testName);
    1.21 +    }            
    1.22 +
    1.23 +    @Override
    1.24 +    protected void setUp() throws Exception {
    1.25 +        super.setUp();
    1.26 +    }
    1.27 +
    1.28 +    @Override
    1.29 +    protected void tearDown() throws Exception {
    1.30 +        super.tearDown();
    1.31 +    }
    1.32 +    
    1.33 +    public void testFactorial3() {
    1.34 +        if (Boolean.getBoolean("no.failures")) return;
    1.35 +        assertEquals(6, Factorial.factorial(3));
    1.36 +    }
    1.37 +    
    1.38 +    public void testFactorial4() {
    1.39 +        if (Boolean.getBoolean("no.failures")) return;
    1.40 +        assertEquals(24, Factorial.factorial(4));
    1.41 +    }
    1.42 +    
    1.43 +    public void testFactorial5() {
    1.44 +        if (Boolean.getBoolean("no.failures")) return;
    1.45 +        assertEquals(120, Factorial.factorial(5));
    1.46 +    }
    1.47 +}