def test_AggFromNumpy(self): x = Coordinate(0) a = np.array([1, 2, 3]) L = AggExpr(1, x, a) print(L) assert (L[0].sameas(ConstantScalarExpr(1)) and L[1] == x and L[2].sameas(ConstantVectorExpr(a)))
def test_AggFromNumber2(self): x = Coordinate(0) L = AggExpr(1, x) assert (L[0].sameas(ConstantScalarExpr(1)) and L[1] == x)
def test_ZeroTimesConstant1(self): ex = ConstantScalarExpr(0)*ConstantScalarExpr(2) assert(ex == 0)
def test_ConstantTimesZero1(self): ex = ConstantScalarExpr(2)*ConstantScalarExpr(0) assert(ex == 0)
def test_ConstantTimesOne2(self): ex = ConstantScalarExpr(2)*1 assert(ex == ConstantScalarExpr(2))
def test_ConstantTimesConstant(self): ex = ConstantScalarExpr(3)*ConstantScalarExpr(2) assert(ex.data()==6)
def test_ConstantMinusZero2(self): ex = ConstantScalarExpr(1)-0 assert(ex == ConstantScalarExpr(1))
def test_ConstantMinusConstant(self): ex = ConstantScalarExpr(1)-ConstantScalarExpr(2) assert(ex.data()==-1)
def test_ExprTimesZero1(self): y = Coordinate(1) ex = y * ConstantScalarExpr(0) assert(ex == 0)
def test_ZeroMinusExpr2(self): y = Coordinate(1) ex = ConstantScalarExpr(0) - y assert(ex.sameas(-y))
def test_ConstantPlusConstant(self): ex = ConstantScalarExpr(1)+ConstantScalarExpr(2) assert(ex.data()==3)
def test_ExprMinusZero1(self): y = Coordinate(1) ex = y - ConstantScalarExpr(0) assert(ex == y)
def test_ZeroPlusExpr2(self): y = Coordinate(1) ex = ConstantScalarExpr(0) + y assert(ex == y)
def test_ConstantDivideConstant(self): ex = ConstantScalarExpr(3.0)/ConstantScalarExpr(2.0) assert(ex.data()==3.0/2.0)
def test_ConstantPlusZero2(self): ex = ConstantScalarExpr(1)+0 assert(ex == ConstantScalarExpr(1))
def test_ZeroTimesExpr2(self): y = Coordinate(1) ex = ConstantScalarExpr(0) * y assert(ex == 0)
def test_ZeroPlusConstant2(self): ex = 0+ConstantScalarExpr(1) assert(ex == ConstantScalarExpr(1))
def test_OneTimesExpr2(self): y = Coordinate(1) ex = ConstantScalarExpr(1) * y assert(ex == y)
def test_ConstantMinusZero1(self): ex = ConstantScalarExpr(1)-ConstantScalarExpr(0) assert(ex == ConstantScalarExpr(1))
def test_ConstantPlusZero1(self): ex = ConstantScalarExpr(1)+ConstantScalarExpr(0) assert(ex ==ConstantScalarExpr(1))
def test_ZeroMinusConstant2(self): ex = 0-ConstantScalarExpr(1) assert(ex == ConstantScalarExpr(-1))
def test_ExprDividedByOne1(self): y = Coordinate(1) ex = y/ConstantScalarExpr(1) assert(ex == y)
def test_ConstantTimesOne1(self): ex = ConstantScalarExpr(2)*ConstantScalarExpr(1) assert(ex == ConstantScalarExpr(2))
def test_ExprPowerOne1(self): y = Coordinate(1) ex = y**ConstantScalarExpr(1) assert(ex == y)
def test_OneTimesConstant2(self): ex = 1*ConstantScalarExpr(2) assert(ex == ConstantScalarExpr(2))
def test_ExprPowerZero1(self): y = Coordinate(1) ex = y**ConstantScalarExpr(0) assert(ex == 1)
def test_ConstantTimesZero2(self): ex = ConstantScalarExpr(2)*0 assert(ex == 0)
def test_ZeroToAPower1(self): y = Coordinate(1) ex = ConstantScalarExpr(0)**y assert(ex == 0)
def test_ZeroTimesConstant2(self): ex = 1*ConstantScalarExpr(0) assert(ex == 0)
def test_AggFromNumber1(self): L = AggExpr(1) assert (L[0].sameas(ConstantScalarExpr(1)))