samples/apifest1/boolcircuit/test/org/netbeans/apifest/boolcircuit/CircuitTest.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:58:08 +0200
changeset 153 b5cbb797ec0a
parent 133 50bf1b976c0d
child 154 0fd5e9c500b9
permissions -rw-r--r--
up to line 2000
jtulach@153
     1
/*
jtulach@153
     2
 * The contents of this file are subject to the terms of the Common Development
jtulach@153
     3
 * and Distribution License (the License). You may not use this file except in
jtulach@153
     4
 * compliance with the License.
jtulach@153
     5
 *
jtulach@153
     6
 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
jtulach@153
     7
 * or http://www.netbeans.org/cddl.txt.
jtulach@153
     8
 *
jtulach@153
     9
 * When distributing Covered Code, include this CDDL Header Notice in each file
jtulach@153
    10
 * and include the License file at http://www.netbeans.org/cddl.txt.
jtulach@153
    11
 * If applicable, add the following below the CDDL Header, with the fields
jtulach@153
    12
 * enclosed by brackets [] replaced by your own identifying information:
jtulach@153
    13
 * "Portions Copyrighted [year] [name of copyright owner]"
jtulach@153
    14
 *
jtulach@153
    15
 * The Original Software is NetBeans. The Initial Developer of the Original
jtulach@153
    16
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
jtulach@153
    17
 * Microsystems, Inc. All Rights Reserved.
jtulach@153
    18
 */
jtulach@153
    19
jtulach@52
    20
package org.netbeans.apifest.boolcircuit;
jtulach@52
    21
jtulach@153
    22
import java.security.CodeSource;
jtulach@153
    23
import java.security.Permission;
jtulach@153
    24
import java.security.PermissionCollection;
jtulach@153
    25
import java.security.Policy;
jtulach@153
    26
import java.util.Collection;
jtulach@153
    27
import java.util.Collections;
jtulach@153
    28
import java.util.Enumeration;
jtulach@52
    29
import junit.framework.TestCase;
jtulach@52
    30
import junit.framework.*;
jtulach@52
    31
jtulach@52
    32
// BEGIN: apifest.CircuitTest
jtulach@52
    33
/** The initial quest for this APIFest is to create an API for boolean 
jtulach@52
    34
 * circuits. Such API shall be able to compose a boolean circuit from
jtulach@52
    35
 * basic elements and evaluate the result given initial values for 
jtulach@52
    36
 * input variables.
jtulach@52
    37
 * <p>
jtulach@52
    38
 * The basic elements include:
jtulach@52
    39
 * <ul>
jtulach@52
    40
 *   <li>negation - has one input and one output and changes 0 on input to 
jtulach@52
    41
 *          on output 1 and 1 to 0
jtulach@52
    42
 *   <li>and - has two inputs and one output. The output is 1 only if both 
jtulach@52
    43
 *          inputs are 1, otherwise it is 0
jtulach@153
    44
 *   <li>or - has two inputs and one output. The output is 1 always, except
jtulach@153
    45
 *          in the case when both inputs are 0
jtulach@52
    46
 * </ul>
jtulach@52
    47
 *
jtulach@52
    48
 * <p>
jtulach@153
    49
 * The boolean circuit can be used to represent boolean formulas and compute
jtulach@153
    50
 * the results for certain values of its inputs. The individual tasks described
jtulach@153
    51
 * as tests bellow.
jtulach@52
    52
 *
jtulach@52
    53
 * <p>
jtulach@52
    54
 * Links of interest:
jtulach@52
    55
 * <ul>
jtulach@153
    56
 *   <li><a href="http://en.wikipedia.org/wiki/Truth_table">Truth table</a>
jtulach@153
    57
 *   <li><a href="http://en.wikipedia.org/wiki/Tautology_(logic)">Taugology</a>
jtulach@52
    58
 * </ul>
jtulach@52
    59
 */
jtulach@52
    60
public class CircuitTest extends TestCase {
jtulach@52
    61
    static {
jtulach@52
    62
        // your code shall run without any permissions
jtulach@52
    63
    }
jtulach@52
    64
    
jtulach@52
    65
    public CircuitTest(String testName) {
jtulach@52
    66
        super(testName);
jtulach@52
    67
    }
jtulach@52
    68
jtulach@52
    69
    protected void setUp() throws Exception {
jtulach@52
    70
    }
jtulach@52
    71
jtulach@52
    72
    protected void tearDown() throws Exception {
jtulach@52
    73
    }
jtulach@52
    74
    
jtulach@52
    75
    
jtulach@52
    76
    /** 
jtulach@52
    77
     * Create a circuit to evaluate x1 and x2 and then
jtulach@52
    78
     * verify that its result is false for input (false, true) and
jtulach@52
    79
     * it is true for input (true, true).
jtulach@52
    80
     */
jtulach@52
    81
    public void testX1andX2() {
jtulach@52
    82
        fail("task1");
jtulach@52
    83
    }
jtulach@52
    84
    
jtulach@52
    85
    /** 
jtulach@52
    86
     * Create a circuit to evaluate (x1 and x2) or x3 and then
jtulach@52
    87
     * verify that its result is false for input (false, true, false) and
jtulach@52
    88
     * it is true for input (false, false, true).
jtulach@52
    89
     */
jtulach@52
    90
    public void testX1andX2orX3() {
jtulach@52
    91
        fail("task2");
jtulach@52
    92
    }
jtulach@52
    93
    /** 
jtulach@52
    94
     * Create a circuit to evaluate (x1 or not(x1)) and then
jtulach@52
    95
     * verify that its result is true for all values of x1.
jtulach@52
    96
     */
jtulach@52
    97
    public void testAlwaysTrue() {
jtulach@52
    98
        fail("task3");
jtulach@52
    99
    }
jtulach@52
   100
    
jtulach@52
   101
}
jtulach@52
   102
// END: apifest.CircuitTest