src/test/java/org/thegalactic/context/constraint/numerical/NumericalStorageTest.java
@Test
    public void testUnion() {
        NumericalStorage storage1 = NumericalStorage.create(10);
        NumericalStorage storage2 = NumericalStorage.create(10);
        initializeAllen(storage1, storage2);

        storage1.union(storage2);

        assertEquals(0, storage1.getInf(0), 0.01);
        assertEquals(30, storage1.getSup(0), 0.01);

        assertEquals(0, storage1.getInf(1), 0.01);
        assertEquals(20, storage1.getSup(1), 0.01);

        assertEquals(0, storage1.getInf(2), 0.01);
        assertEquals(15, storage1.getSup(2), 0.01);

        assertEquals(0, storage1.getInf(3), 0.01);
        assertEquals(15, storage1.getSup(3), 0.01);

        assertEquals(-5, storage1.getInf(4), 0.01);
        assertEquals(15, storage1.getSup(4), 0.01);

        assertEquals(-5, storage1.getInf(5), 0.01);
        assertEquals(10, storage1.getSup(5), 0.01);

        assertEquals(0, storage1.getInf(6), 0.01);
        assertEquals(10, storage1.getSup(6), 0.01);

        try {
            storage1.union(NumericalStorage.create(5));
            fail("An IllegalArgumentException must be thrown");
        } catch (IllegalArgumentException e) {
            assertEquals("NumericalStorage objects must have the same size", e.getMessage());
        }
    }
/**
     * Test of union method, of class NumericalStorage.
     */
Test of union method, of class NumericalStorage.
Test of union method of class NumericalStorage .
@Test
    public void testUnion() {
        NumericalStorage storage1 = NumericalStorage.create(10);
        NumericalStorage storage2 = NumericalStorage.create(10);
        initializeAllen(storage1, storage2);
        storage1.union(storage2);
        assertEquals(0, storage1.getInf(0), 0.01);
        assertEquals(30, storage1.getSup(0), 0.01);
        assertEquals(0, storage1.getInf(1), 0.01);
        assertEquals(20, storage1.getSup(1), 0.01);
        assertEquals(0, storage1.getInf(2), 0.01);
        assertEquals(15, storage1.getSup(2), 0.01);
        assertEquals(0, storage1.getInf(3), 0.01);
        assertEquals(15, storage1.getSup(3), 0.01);
        assertEquals(-5, storage1.getInf(4), 0.01);
        assertEquals(15, storage1.getSup(4), 0.01);
        assertEquals(-5, storage1.getInf(5), 0.01);
        assertEquals(10, storage1.getSup(5), 0.01);
        assertEquals(0, storage1.getInf(6), 0.01);
        assertEquals(10, storage1.getSup(6), 0.01);
        try {
            storage1.union(NumericalStorage.create(5));
            fail("An IllegalArgumentException must be thrown");
        } catch (IllegalArgumentException e) {
            assertEquals("NumericalStorage objects must have the same size", e.getMessage());
        }
    }
@ Test public void testUnion ( ) { NumericalStorage storage1 = NumericalStorage . create ( 10 ) ; NumericalStorage storage2 = NumericalStorage . create ( 10 ) ; initializeAllen ( storage1 , storage2 ) ; storage1 . union ( storage2 ) ; assertEquals ( 0 , storage1 . getInf ( 0 ) , 0.01 ) ; assertEquals ( 30 , storage1 . getSup ( 0 ) , 0.01 ) ; assertEquals ( 0 , storage1 . getInf ( 1 ) , 0.01 ) ; assertEquals ( 20 , storage1 . getSup ( 1 ) , 0.01 ) ; assertEquals ( 0 , storage1 . getInf ( 2 ) , 0.01 ) ; assertEquals ( 15 , storage1 . getSup ( 2 ) , 0.01 ) ; assertEquals ( 0 , storage1 . getInf ( 3 ) , 0.01 ) ; assertEquals ( 15 , storage1 . getSup ( 3 ) , 0.01 ) ; assertEquals ( - 5 , storage1 . getInf ( 4 ) , 0.01 ) ; assertEquals ( 15 , storage1 . getSup ( 4 ) , 0.01 ) ; assertEquals ( - 5 , storage1 . getInf ( 5 ) , 0.01 ) ; assertEquals ( 10 , storage1 . getSup ( 5 ) , 0.01 ) ; assertEquals ( 0 , storage1 . getInf ( 6 ) , 0.01 ) ; assertEquals ( 10 , storage1 . getSup ( 6 ) , 0.01 ) ; try { storage1 . union ( NumericalStorage . create ( 5 ) ) ; fail ( "An IllegalArgumentException must be thrown" ) ; } catch ( IllegalArgumentException e ) { assertEquals ( "NumericalStorage objects must have the same size" , e . getMessage ( ) ) ; } }
Test of union method, of class NumericalStorage.
Test of union method of class NumericalStorage .