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

        storage1.intersection(storage2);

        assertTrue(storage1.isEmpty(0));

        assertEquals(10, storage1.getInf(1), 0.01);
        assertEquals(10, storage1.getSup(1), 0.01);

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

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

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

        assertEquals(0, 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.intersection(NumericalStorage.create(5));
            fail("An IllegalArgumentException must be thrown");
        } catch (IllegalArgumentException e) {
            assertEquals("NumericalStorage objects must have the same size", e.getMessage());
        }
    }
/**
     * Test of intersection method, of class NumericalStorage.
     */
Test of intersection method, of class NumericalStorage.
Test of intersection method of class NumericalStorage .
@Test
    public void testIntersection() {
        NumericalStorage storage1 = NumericalStorage.create(10);
        NumericalStorage storage2 = NumericalStorage.create(10);
        initializeAllen(storage1, storage2);
        storage1.intersection(storage2);
        assertTrue(storage1.isEmpty(0));
        assertEquals(10, storage1.getInf(1), 0.01);
        assertEquals(10, storage1.getSup(1), 0.01);
        assertEquals(5, storage1.getInf(2), 0.01);
        assertEquals(10, storage1.getSup(2), 0.01);
        assertEquals(0, storage1.getInf(3), 0.01);
        assertEquals(10, storage1.getSup(3), 0.01);
        assertEquals(0, storage1.getInf(4), 0.01);
        assertEquals(10, storage1.getSup(4), 0.01);
        assertEquals(0, 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.intersection(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 testIntersection ( ) { NumericalStorage storage1 = NumericalStorage . create ( 10 ) ; NumericalStorage storage2 = NumericalStorage . create ( 10 ) ; initializeAllen ( storage1 , storage2 ) ; storage1 . intersection ( storage2 ) ; assertTrue ( storage1 . isEmpty ( 0 ) ) ; assertEquals ( 10 , storage1 . getInf ( 1 ) , 0.01 ) ; assertEquals ( 10 , storage1 . getSup ( 1 ) , 0.01 ) ; assertEquals ( 5 , storage1 . getInf ( 2 ) , 0.01 ) ; assertEquals ( 10 , storage1 . getSup ( 2 ) , 0.01 ) ; assertEquals ( 0 , storage1 . getInf ( 3 ) , 0.01 ) ; assertEquals ( 10 , storage1 . getSup ( 3 ) , 0.01 ) ; assertEquals ( 0 , storage1 . getInf ( 4 ) , 0.01 ) ; assertEquals ( 10 , storage1 . getSup ( 4 ) , 0.01 ) ; assertEquals ( 0 , 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 . intersection ( NumericalStorage . create ( 5 ) ) ; fail ( "An IllegalArgumentException must be thrown" ) ; } catch ( IllegalArgumentException e ) { assertEquals ( "NumericalStorage objects must have the same size" , e . getMessage ( ) ) ; } }
Test of intersection method, of class NumericalStorage.
Test of intersection method of class NumericalStorage .