Package barsuift.simLife.universe

Examples of barsuift.simLife.universe.MockUniverse


        super.tearDown();
    }

    public void testBasicTreeTrunk() {
        try {
            new BasicTreeTrunk(new MockUniverse(), null);
            fail("Should throw an IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // OK expected exception
        }
        try {
View Full Code Here


    public void testGetState() {
        TreeTrunkStateFactory factory = new TreeTrunkStateFactory();
        float radius = 4.2f;
        float height = 6.8f;
        TreeTrunkState trunkState = factory.createRandomTreeTrunkState(radius, height);
        BasicTreeTrunk treeTrunk = new BasicTreeTrunk(new MockUniverse(), trunkState);
        assertEquals(height, treeTrunk.getHeight());
        assertEquals(radius, treeTrunk.getRadius());
        assertEquals(trunkState, treeTrunk.getState());
    }
View Full Code Here

    }

    public void testSpendTime() {
        TreeTrunkState trunkState = new TreeTrunkState();
        trunkState.setAge(12);
        BasicTreeTrunk treeTrunk = new BasicTreeTrunk(new MockUniverse(), trunkState);
        treeTrunk.spendTime();
        assertEquals(13, treeTrunk.getAge());
    }
View Full Code Here

    private BasicTreeBranchPart branchPart;

    protected void setUp() throws Exception {
        super.setUp();
        universe = new MockUniverse();
        branchPartState = CoreDataCreatorForTests.createSpecificTreeBranchPartState();
        branchPart = new BasicTreeBranchPart(universe, branchPartState);
    }
View Full Code Here

        // it ends at 3.5
        // 0 ...... ...... 2 ...... 3 ... 3.5
        // the new leaf should be created around 1 (+/- 10% * distance -> 0.2)
        Point3d boundsStartPoint = new Point3d(0.8, 0, 0);
        Point3d boundsEndPoint = new Point3d(1.2, 0, 0);
        BasicTreeBranchPart part = new BasicTreeBranchPart(new MockUniverse(), partState);
        Point3d pointForNewLeaf = part.computeAttachPointForNewLeaf();
        PointTestHelper.assertPointIsWithinBounds(pointForNewLeaf, boundsStartPoint, boundsEndPoint);
    }
View Full Code Here

        // it ends at 7
        // 0 ...... 1 ...... ...... ...... ...... 5 ...... ...... 7
        // the new leaf should be created around 3 (+/- 10% * distance -> 0.4)
        Point3d boundsStartPoint = new Point3d(2.6, 0, 0);
        Point3d boundsEndPoint = new Point3d(3.4, 0, 0);
        BasicTreeBranchPart part = new BasicTreeBranchPart(new MockUniverse(), partState);
        Point3d pointForNewLeaf = part.computeAttachPointForNewLeaf();
        PointTestHelper.assertPointIsWithinBounds(pointForNewLeaf, boundsStartPoint, boundsEndPoint);
    }
View Full Code Here

        // it ends at 6
        // 0 ...... ...... 2 ...... 3 ...... ...... ...... 6
        // the new leaf should be created around 4.5 (+/- 10% * distance -> 0.3)
        Point3d boundsStartPoint = new Point3d(4.2, 0, 0);
        Point3d boundsEndPoint = new Point3d(4.8, 0, 0);
        BasicTreeBranchPart part = new BasicTreeBranchPart(new MockUniverse(), partState);
        Point3d pointForNewLeaf = part.computeAttachPointForNewLeaf();
        PointTestHelper.assertPointIsWithinBounds(pointForNewLeaf, boundsStartPoint, boundsEndPoint);
    }
View Full Code Here

        // it ends at 3.5
        // 0 ...... ...... 2 ...... 3 ... 3.5
        // the new leaf should be created around 1 (+/- 10% * distance -> 0.2)
        Point3d boundsStartPoint = new Point3d(0.8, 0, 0);
        Point3d boundsEndPoint = new Point3d(1.2, 0, 0);
        BasicTreeBranchPart part = new BasicTreeBranchPart(new MockUniverse(), partState);
        Point3d pointForNewLeaf = part.computeAttachPointForNewLeaf();
        PointTestHelper.assertPointIsWithinBounds(pointForNewLeaf, boundsStartPoint, boundsEndPoint);
    }
View Full Code Here

    public void testCreateOneNewLeaf() {
        // create object states
        TreeBranchPartState partState = new TreeBranchPartState();
        partState.setEnergy(new BigDecimal(150));
        BasicTreeBranchPart part = new BasicTreeBranchPart(new MockUniverse(), partState);

        assertEquals(0, part.getNbLeaves());
        assertEquals(0, part.getBranchPart3D().getLeaves().size());

        part.createOneNewLeaf();
View Full Code Here

    public void testCanCreateOneNewLeaf() {
        BasicTreeBranchPart part;
        TreeBranchPartState partState = new TreeBranchPartState();
        partState.setEnergy(new BigDecimal(89));
        part = new BasicTreeBranchPart(new MockUniverse(), partState);
        assertFalse(part.canCreateOneNewLeaf());

        partState.setEnergy(new BigDecimal(150));
        part = new BasicTreeBranchPart(new MockUniverse(), partState);
        assertTrue(part.canCreateOneNewLeaf());

        List<TreeLeafState> leaveStates = new ArrayList<TreeLeafState>();
        leaveStates.add(new TreeLeafState());
        leaveStates.add(new TreeLeafState());
        leaveStates.add(new TreeLeafState());
        partState.setLeaveStates(leaveStates);
        part = new BasicTreeBranchPart(new MockUniverse(), partState);
        assertTrue(part.canCreateOneNewLeaf());

        leaveStates.add(new TreeLeafState());
        part = new BasicTreeBranchPart(new MockUniverse(), partState);
        assertFalse(part.canCreateOneNewLeaf());
    }
View Full Code Here

TOP

Related Classes of barsuift.simLife.universe.MockUniverse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.