use of org.eclipse.smarthome.core.types.State in project smarthome by eclipse.
the class ArithmeticGroupFunctionTest method testAndFunction_negative.
@Test
public void testAndFunction_negative() {
items.add(new TestItem("TestItem1", OpenClosedType.OPEN));
items.add(new TestItem("TestItem2", UnDefType.UNDEF));
items.add(new TestItem("TestItem3", OpenClosedType.OPEN));
items.add(new TestItem("TestItem4", OpenClosedType.OPEN));
items.add(new TestItem("TestItem5", UnDefType.UNDEF));
function = new ArithmeticGroupFunction.And(OpenClosedType.OPEN, OpenClosedType.CLOSED);
State state = function.calculate(items);
assertEquals(OpenClosedType.CLOSED, state);
}
use of org.eclipse.smarthome.core.types.State in project smarthome by eclipse.
the class ArithmeticGroupFunctionTest method testNOrFunction.
@Test
public void testNOrFunction() {
items.add(new TestItem("TestItem1", OpenClosedType.CLOSED));
items.add(new TestItem("TestItem2", UnDefType.UNDEF));
items.add(new TestItem("TestItem3", OpenClosedType.OPEN));
items.add(new TestItem("TestItem4", OpenClosedType.CLOSED));
items.add(new TestItem("TestItem5", UnDefType.UNDEF));
function = new ArithmeticGroupFunction.NOr(OpenClosedType.OPEN, OpenClosedType.CLOSED);
State state = function.calculate(items);
assertEquals(OpenClosedType.CLOSED, state);
}
use of org.eclipse.smarthome.core.types.State in project smarthome by eclipse.
the class QuantityTypeArithmeticGroupFunctionTest method testAvgFunctionQuantityTypeDifferentUnits.
@Test
public void testAvgFunctionQuantityTypeDifferentUnits() {
items.add(createNumberItem("TestItem1", Temperature.class, new QuantityType<Temperature>("100 °C")));
items.add(createNumberItem("TestItem2", Temperature.class, UnDefType.NULL));
items.add(createNumberItem("TestItem3", Temperature.class, new QuantityType<Temperature>("113 °F")));
items.add(createNumberItem("TestItem4", Temperature.class, UnDefType.UNDEF));
items.add(createNumberItem("TestItem5", Temperature.class, new QuantityType<Temperature>("294.15 K")));
function = new QuantityTypeArithmeticGroupFunction.Avg(Temperature.class);
State state = function.calculate(items);
assertEquals(new QuantityType<Temperature>("55.33 °C"), state);
}
use of org.eclipse.smarthome.core.types.State in project smarthome by eclipse.
the class QuantityTypeArithmeticGroupFunctionTest method testMinFunctionQuantityTypeDifferentUnits.
@Test
public void testMinFunctionQuantityTypeDifferentUnits() {
items.add(createNumberItem("TestItem1", Temperature.class, new QuantityType<Temperature>("100 °C")));
items.add(createNumberItem("TestItem2", Temperature.class, UnDefType.NULL));
items.add(createNumberItem("TestItem3", Temperature.class, new QuantityType<Temperature>("113 °F")));
items.add(createNumberItem("TestItem4", Temperature.class, UnDefType.UNDEF));
items.add(createNumberItem("TestItem5", Temperature.class, new QuantityType<Temperature>("294.15 K")));
function = new QuantityTypeArithmeticGroupFunction.Min(Temperature.class);
State state = function.calculate(items);
assertEquals(new QuantityType<Temperature>("294.15 K"), state);
}
use of org.eclipse.smarthome.core.types.State in project smarthome by eclipse.
the class QuantityTypeArithmeticGroupFunctionTest method testAvgFunctionQuantityType.
@Test
public void testAvgFunctionQuantityType() {
items.add(createNumberItem("TestItem1", Temperature.class, new QuantityType<Temperature>("100 °C")));
items.add(createNumberItem("TestItem2", Temperature.class, UnDefType.NULL));
items.add(createNumberItem("TestItem3", Temperature.class, new QuantityType<Temperature>("200 °C")));
items.add(createNumberItem("TestItem4", Temperature.class, UnDefType.UNDEF));
items.add(createNumberItem("TestItem5", Temperature.class, new QuantityType<Temperature>("300 °C")));
function = new QuantityTypeArithmeticGroupFunction.Avg(Temperature.class);
State state = function.calculate(items);
assertEquals(new QuantityType<Temperature>("200 °C"), state);
}
Aggregations