samples/apifest1/boolcircuit/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:58:11 +0200
changeset 154 0fd5e9c500b9
parent 153 b5cbb797ec0a
child 263 7e8e995065c5
permissions -rw-r--r--
Merge: Geertjan's changs up to 2000
     1 package org.netbeans.apifest.boolcircuit;
     2 
     3 import junit.framework.TestCase;
     4 import junit.framework.*;
     5 
     6 // BEGIN: apifest.CircuitTest
     7 /** The initial quest for this APIFest is to create an API for boolean 
     8  * circuits. Such API shall be able to compose a boolean circuit from
     9  * basic elements and evaluate the result given initial values for 
    10  * input variables.
    11  * <p>
    12  * The basic elements include:
    13  * <ul>
    14  *   <li>negation - has one input and one output and changes 0 on input to 
    15  *          on output 1 and 1 to 0
    16  *   <li>and - has two inputs and one output. The output is 1 only if both 
    17  *          inputs are 1, otherwise it is 0
    18  *   <li>or - has two inputs and one output. The output is 1 always, 
    19  *          except in the case when both inputs are 0
    20  * </ul>
    21  *
    22  * <p>
    23  * The boolean circuit can be used to represent boolean formulas and 
    24  * compute the results for certain values of its inputs. The individual
    25  * tasks described as tests bellow.
    26  *
    27  * <p>
    28  * Links of interest:
    29  * <ul>
    30  *   <li>
    31  *      <a href="http://en.wikipedia.org/wiki/Truth_table">
    32  *          Truth table</a>
    33  *   <li>
    34  *      <a href="http://en.wikipedia.org/wiki/Tautology_(logic)">
    35  *          Taugology</a>
    36  * </ul>
    37  */
    38 public class CircuitTest extends TestCase {
    39     static {
    40         // your code shall run without any permissions
    41     }
    42     
    43     public CircuitTest(String testName) {
    44         super(testName);
    45     }
    46 
    47     protected void setUp() throws Exception {
    48     }
    49 
    50     protected void tearDown() throws Exception {
    51     }
    52     
    53     
    54     /** 
    55      * Create a circuit to evaluate x1 and x2 and then
    56      * verify that its result is false for input (false, true) and
    57      * it is true for input (true, true).
    58      */
    59     public void testX1andX2() {
    60         fail("task1");
    61     }
    62     
    63     /** 
    64      * Create a circuit to evaluate (x1 and x2) or x3 and then
    65      * verify that its result is false for input (false, true, false) and
    66      * it is true for input (false, false, true).
    67      */
    68     public void testX1andX2orX3() {
    69         fail("task2");
    70     }
    71     /** 
    72      * Create a circuit to evaluate (x1 or not(x1)) and then
    73      * verify that its result is true for all values of x1.
    74      */
    75     public void testAlwaysTrue() {
    76         fail("task3");
    77     }
    78     
    79 }
    80 // END: apifest.CircuitTest