int depth = strategy.getIterationDepth(inputDepths); for (int index = 1; index < strategies.size(); index++) { .getDesiredCardinalities(); strategy = strategies.get(index); depth += strategy.getIterationDepth(stagedInputDepths);
/** * Test simple iteration type check based on dot products * * @throws IterationTypeMismatchException */ public void testDotUnstagedIteration() throws IterationTypeMismatchException { IterationStrategyImpl isi = getISDot(0, 0); assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 1, 1 })) == 1); assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 2, 2 })) == 2); isi = getISDot(0, 1); assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 1, 2 })) == 1); }
/** * Test a simple iteration based on a cross product * * @throws IterationTypeMismatchException */ public void testCrossUnstagedIteration() throws IterationTypeMismatchException { IterationStrategyImpl isi = getISCross(0, 0); assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 1, 1 })) == 2); assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 2, 2 })) == 4); assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 1, 2 })) == 3); isi = getISCross(0, 1); assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 1, 2 })) == 2); }
/** * Test that attempting to typecheck a mismatched dot product produces a * type mismatch exception * */ public void testValidationFailureWithDot() { try { IterationStrategyImpl isi = getISDot(0, 0); isi.getIterationDepth(getDepths(new String[] { "a", "b" }, new int[] { 1, 2 })); fail("should have failed due to mismatch"); } catch (IterationTypeMismatchException itme) { // Correct behaviour, this should cause a mismatch } }