3
import dk.aau.cs.model.tapn.Bound;
4
import dk.aau.cs.model.tapn.IntBound;
5
import dk.aau.cs.model.tapn.TimeInterval;
1
import dk.aau.cs.model.tapn.*;
6
2
import dk.aau.cs.util.RequireException;
3
import org.junit.jupiter.api.Test;
4
import org.junit.jupiter.api.Assertions;
5
import static org.junit.jupiter.api.Assertions.assertThrows;
8
7
public class TimeIntervalTest {
10
@Test(expected=RequireException.class)
11
10
public void TimeIntervalConstructor(){
12
new TimeInterval(false, new IntBound(0), new IntBound(0), true);
11
assertThrows(RequireException.class, ()-> new TimeInterval(false, new IntBound(0), new IntBound(0), true));
15
@Test(expected=RequireException.class)
16
15
public void TimeIntervalConstructor_intervaltype2(){
17
new TimeInterval(true, new IntBound(5), new IntBound(5), false);
16
assertThrows(RequireException.class, ()-> new TimeInterval(true, new IntBound(5), new IntBound(5), false));
20
@Test(expected=RequireException.class)
21
20
public void TimeIntervalConstructor_intervaltype3(){
22
new TimeInterval(false, new IntBound(5), new IntBound(5), false);
21
assertThrows(RequireException.class, ()-> new TimeInterval(false, new IntBound(5), new IntBound(5), false));
25
@Test(expected=RequireException.class)
26
25
public void TimeIntervalConstructor_intervaltype4(){
27
new TimeInterval(true, new IntBound(6), new IntBound(5), false);
26
assertThrows(RequireException.class, ()-> new TimeInterval(true, new IntBound(6), new IntBound(5), false));
30
@Test(expected=RequireException.class)
31
30
public void TimeIntervalConstructor_intervaltype5(){
32
new TimeInterval(false, new IntBound(6), new IntBound(5), false);
31
assertThrows(RequireException.class, ()-> new TimeInterval(false, new IntBound(6), new IntBound(5), false));
37
36
new TimeInterval(true, new IntBound(6), Bound.Infinity, false);
40
@Test(expected=RequireException.class)
41
40
public void TimeInterval_InfinityUpper_included(){
42
new TimeInterval(true, new IntBound(6), Bound.Infinity, true);
41
assertThrows(RequireException.class, ()-> new TimeInterval(true, new IntBound(6), Bound.Infinity, true));
45
@Test(expected=RequireException.class)
46
45
public void TimeInterval_Infinity_lower(){
47
new TimeInterval(true, Bound.Infinity, Bound.Infinity, false);
46
assertThrows(RequireException.class, ()-> new TimeInterval(true, Bound.Infinity, Bound.Infinity, false));
49
//XXX tests used when refactoring toString to call toString(true)
51
public void IntervalToStringTrueIsSameAsIntervalToString() {
52
TimeInterval t = new TimeInterval(true, new IntBound(0), Bound.Infinity, false);
53
TimeInterval t2 = new TimeInterval(true, new ConstantBound(new Constant("k", 5)),new IntBound(8), false);
55
Assertions.assertEquals(t.toString(), t.toString(true));
56
Assertions.assertEquals(t.toString(), t.toString(false));
58
Assertions.assertEquals(t2.toString(), t2.toString(true));
59
Assertions.assertNotEquals(t2.toString(), t2.toString(false));
53
64
public void timeInterval(){