EqualBasis

Aus JACK Wiki
Zur Navigation springen Zur Suche springen

Beschreibung

Syntax

 equalBasis(List list1, List list2, Ganzzahl dimension)

Parameter

  • list1 - Liste mit Vektoren
  • list2 - Liste mit Vektoren
  • dimension - dimension

Return Value

Beispiele

 equalBasis(list(vector(1,1,0),vector(0,1,1)), list(vector(1,1,0),vector(0,1,1)), 3)    -->    True

JUnit Tests

[Anzeigen]

@BeforeClass
public static void beforeTest() {
	
		//set(vector(1,2,3),vector(3,3,3))
		equalBasisFillInVariableMap.put(1, OMConverter.toObject("<OMOBJ><OMA><OMS cd='list1' name='list'/><OMA><OMS cd='linalg2' name='vector'/><OMI>1</OMI><OMI>2</OMI><OMI>3</OMI></OMA><OMA><OMS cd='linalg2' name='vector'/><OMI>3</OMI><OMI>3</OMI><OMI>3</OMI></OMA></OMA></OMOBJ>"));
		//set(vector(2,5,6),vector(3,3,3))
		equalBasisFillInVariableMap.put(2, OMConverter.toObject("<OMOBJ><OMA><OMS cd='list1' name='list'/><OMA><OMS cd='linalg2' name='vector'/><OMI>2</OMI><OMI>5</OMI><OMI>6</OMI></OMA><OMA><OMS cd='linalg2' name='vector'/><OMI>3</OMI><OMI>3</OMI><OMI>3</OMI></OMA></OMA></OMOBJ>"));

		//set(vector(1,2,3),vector(3,3,3))
		equalBasisExerciseVariableMap.put("a", OMConverter.toObject("<OMOBJ><OMA><OMS cd='list1' name='list'/><OMA><OMS cd='linalg2' name='vector'/><OMI>1</OMI><OMI>2</OMI><OMI>3</OMI></OMA><OMA><OMS cd='linalg2' name='vector'/><OMI>3</OMI><OMI>3</OMI><OMI>3</OMI></OMA></OMA></OMOBJ>"));
		//set(vector(2,5,6),vector(3,3,3))
		equalBasisExerciseVariableMap.put("b", OMConverter.toObject("<OMOBJ><OMA><OMS cd='list1' name='list'/><OMA><OMS cd='linalg2' name='vector'/><OMI>2</OMI><OMI>5</OMI><OMI>6</OMI></OMA><OMA><OMS cd='linalg2' name='vector'/><OMI>3</OMI><OMI>3</OMI><OMI>3</OMI></OMA></OMA></OMOBJ>"));
	
}

@Test
public void testEqualBasis1() {
	assertTrue(Evaluator.getBooleanResult("equalBasis('{vector(1,1,0);vector(0,1,1)}', 'set(vector(1,1,0),vector(0,1,1))', '3')", equalBasisExerciseVariableMap, equalBasisFillInVariableMap));
}

@Test
public void testEqualBasis2() {
	assertTrue(!Evaluator.getBooleanResult("equalBasis('set(vector(1,1,1),vector(0,1,1))', 'set(vector(1,1,0),vector(0,1,1))', '3')", equalBasisExerciseVariableMap, equalBasisFillInVariableMap));
}

@Test
public void testEqualBasis3() {
	assertTrue(Evaluator.getBooleanResult("equalBasis('{vector(1,1);vector(0,1)}', '{vector(1,1);vector(0,1)}', '2')", equalBasisExerciseVariableMap, equalBasisFillInVariableMap));
}

@Test
public void testEqualBasis4() {
	assertTrue(Evaluator.getBooleanResult("equalBasis('set(vector(1,1),vector(0,1))', '{vector(1,1);vector(0,1)}', '2')", equalBasisExerciseVariableMap, equalBasisFillInVariableMap));
}

@Test
public void testEqualBasis5() {
	assertTrue(Evaluator.getBooleanResult("equalBasis('set(vector(1,1,0),vector(0,1,1))', '{vector(1,1,0);vector(0,1,1)}', '3')", equalBasisExerciseVariableMap, equalBasisFillInVariableMap));
}

@Test
public void testEqualBasis6() {
	assertTrue(Evaluator.getBooleanResult("equalBasis('set(vector(1,1,0),vector(0,1,1))', 'set(vector(3,3,0),vector(0,1,1))', '3')", equalBasisExerciseVariableMap, equalBasisFillInVariableMap));
}

@Test
public void testEqualBasisWithInput1() {
	assertTrue(Evaluator.getBooleanResult("equalBasis('[pos=1]', '[pos=1]', '3')", equalBasisExerciseVariableMap, equalBasisFillInVariableMap));
}

@Test
public void testEqualBasisWithInput2() {
	assertTrue(!Evaluator.getBooleanResult("equalBasis('[pos=1]', '[pos=2]', '3')", equalBasisExerciseVariableMap, equalBasisFillInVariableMap));
}

@Test
public void testEqualBasisWithVariables1() {
	assertTrue(Evaluator.getBooleanResult("equalBasis('[var=a]', '[var=a]', '3')", equalBasisExerciseVariableMap, equalBasisFillInVariableMap));
}

@Test
public void testEqualBasisWithVariables2() {
	assertTrue(!Evaluator.getBooleanResult("equalBasis('[var=a]', '[var=b]', '3')", equalBasisExerciseVariableMap, equalBasisFillInVariableMap));
}

@Test(expected=FunctionInvalidArgumentTypeException.class)
public void testEqualBasisWithWrongInputCharacterAsThirdParameter() {
	Evaluator.getBooleanResult("equalBasis('(vector(QQ,(1,1,0)),vector(QQ,(0,1,1)))', '(vector(QQ,(3,3,0)),vector(QQ,(0,1,1)))', 'c')", equalBasisExerciseVariableMap, equalBasisFillInVariableMap);
	fail();
}

@Test(expected=FunctionInvalidArgumentTypeException.class)
public void testEqualBasisWithWrongInputToManyCommas() {
	Evaluator.getBooleanResult("equalBasis('(vector(QQ,,(1,1,,0)),vector(QQ,(0,1,1)))', '(vector(QQ,(3,3,0)),vector(QQ,(0,1,1)))', '3')", equalBasisExerciseVariableMap, equalBasisFillInVariableMap);
	fail();
}

@Test(expected=ParserException.class)
public void TestEqualBasisWithONECharacter() {
	Evaluator.getBooleanResult("equalBasis(ab, ab, ab)", equalBasisExerciseVariableMap, equalBasisFillInVariableMap);
	fail();
}

@Test(expected=FunctionInvalidArgumentTypeException.class)
public void testEqualBasisWithEmptyStringArguments() {
	Evaluator.getBooleanResult("equalBasis('', '', '')", equalBasisExerciseVariableMap, equalBasisFillInVariableMap);
	fail();
}

@Test(expected=FunctionInvalidNumberOfArgumentsException.class)
public void testEqualBasisWithEmptyArgument() {
	Evaluator.getBooleanResult("equalBasis()", equalBasisExerciseVariableMap, equalBasisFillInVariableMap);
	fail();
}

@Test(expected=UndefinedExerciseVariableException.class)
public void testEqualBasisWithoutExerciseVariable() {
	Evaluator.getBooleanResult("equalBasis([var=j], [var=j], [var=j])", equalBasisExerciseVariableMap, equalBasisFillInVariableMap);
	fail();
}

@Test(expected=UndefinedFillInVariableException.class)
public void testEqualBasisWithoutInput() {
	Evaluator.getBooleanResult("equalBasis([pos=42], [pos=42], [pos=42])", equalBasisExerciseVariableMap, equalBasisFillInVariableMap);
	fail();
}

Hinweise