mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
add ConstraintSetIndexFactoryTest
This commit is contained in:
parent
ad4581fffb
commit
f614869677
@ -26,7 +26,7 @@ public class ConstraintSetIndexFactory {
|
||||
*
|
||||
* @return the next constraint set index
|
||||
*/
|
||||
public String nextConstraintSetIndex() {
|
||||
protected String nextConstraintSetIndex() {
|
||||
String index = nextConstraintSetIndex == FIRST_CONSTRAINT_SET_INDEX
|
||||
? ""
|
||||
: nextConstraintSetIndex == FIRST_CONSTRAINT_SET_INDEX + 1
|
||||
|
@ -0,0 +1,30 @@
|
||||
package edu.kit.typicalc.view.content.typeinferencecontent.latexcreator;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import static edu.kit.typicalc.view.content.typeinferencecontent.latexcreator.LatexCreatorConstants.*;
|
||||
import static edu.kit.typicalc.view.content.typeinferencecontent.latexcreator.LatexCreatorConstants.CURLY_RIGHT;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class ConstraintSetIndexFactoryTest {
|
||||
|
||||
@Test
|
||||
void nextConstraintSetIndexTest() throws NoSuchFieldException, IllegalAccessException {
|
||||
Field field = ConstraintSetIndexFactory.class.getDeclaredField("FIRST_CONSTRAINT_SET_INDEX");
|
||||
field.setAccessible(true);
|
||||
int firstIndex = field.getInt(null);
|
||||
|
||||
ConstraintSetIndexFactory factory = new ConstraintSetIndexFactory();
|
||||
|
||||
assertEquals("", factory.nextConstraintSetIndex());
|
||||
assertEquals("" + UNDERSCORE + CURLY_LEFT + LET + CURLY_RIGHT, factory.nextConstraintSetIndex());
|
||||
assertEquals("" + UNDERSCORE + CURLY_LEFT + LET + UNDERSCORE
|
||||
+ CURLY_LEFT + (firstIndex + 2) + CURLY_RIGHT + CURLY_RIGHT, factory.nextConstraintSetIndex());
|
||||
assertEquals("" + UNDERSCORE + CURLY_LEFT + LET + UNDERSCORE
|
||||
+ CURLY_LEFT + (firstIndex + 3) + CURLY_RIGHT + CURLY_RIGHT, factory.nextConstraintSetIndex());
|
||||
assertEquals("" + UNDERSCORE + CURLY_LEFT + LET + UNDERSCORE
|
||||
+ CURLY_LEFT + (firstIndex + 4) + CURLY_RIGHT + CURLY_RIGHT, factory.nextConstraintSetIndex());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user