Skip to content

Commit

Permalink
CSP: fix wrong test and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Apfelbeet committed Oct 23, 2024
1 parent 70a88fa commit 4803cd9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion csp/src/main/java/com/booleworks/logicng/csp/CspFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -917,9 +917,11 @@ public CspAssignment decode(final Assignment model, final Collection<IntegerVari
}

/**
* Parses and constructs a {@link CspPredicate} from a string.
* Parses and constructs a {@code CspPredicate} from a string.
* <ul>
* <li>Infix Example: {@code a < b}</li>
* <li>Prefix Example: {@code LE[a, b]}</li>
* </ul>
* @param input input string
* @return the parsed predicate
* @throws ParserException if parsing is not successful
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.booleworks.logicng.csp.terms;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import com.booleworks.logicng.csp.CspFactory;
import com.booleworks.logicng.csp.ParameterizedCspTest;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

import java.util.Set;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

public class IntegerVariableTest extends ParameterizedCspTest {
@ParameterizedTest
@MethodSource("cspFactories")
Expand All @@ -36,7 +36,8 @@ public void testCreation(final CspFactory cf) {
assertThat(c.getDomain().isContiguous()).isTrue();
assertThat(c.getDomain().isEmpty()).isFalse();

assertThatThrownBy(() -> cf.variable("a", 0, 10)).isInstanceOf(IllegalArgumentException.class);
assertThat(cf.variable("a", 0, 10)).isEqualTo(a);
assertThatThrownBy(() -> cf.variable("a", 0, 2)).isInstanceOf(IllegalArgumentException.class);
}

@ParameterizedTest
Expand Down

0 comments on commit 4803cd9

Please sign in to comment.