-
Notifications
You must be signed in to change notification settings - Fork 5
/
SValueTest.groovy
30 lines (25 loc) · 1.91 KB
/
SValueTest.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
* © 2021. TU Dortmund University,
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
* Research group Distribution grid planning and operation
*/
package edu.ie3.datamodel.models.value
import edu.ie3.datamodel.models.StandardUnits
import spock.lang.Specification
import tech.units.indriya.quantity.Quantities
import tech.units.indriya.unit.Units
class SValueTest extends Specification {
def "A SValue's equal method should work as expected on null and provided quantities"() {
expect:
(sVal1 == sVal2) == res
where:
sVal1 | sVal2 || res
new SValue(null, null) | new SValue(null, null) || true
new SValue(Quantities.getQuantity(10d, StandardUnits.ACTIVE_POWER_IN), null) | new SValue(Quantities.getQuantity(10d, StandardUnits.ACTIVE_POWER_IN), null) || true
new SValue(Quantities.getQuantity(10d, StandardUnits.ACTIVE_POWER_IN), null) | new SValue(null, null) || false
null | new SValue(null, null) || false
null | null || true
new SValue(Quantities.getQuantity(10.23d, StandardUnits.ACTIVE_POWER_IN), null) | new SValue(Quantities.getQuantity(10.23, StandardUnits.ACTIVE_POWER_IN), null) || false
new SValue(Quantities.getQuantity(10230, Units.WATT), null) | new SValue(Quantities.getQuantity(10.23, StandardUnits.ACTIVE_POWER_IN), null) || false
}
}