Skip to content

Commit 32906ce

Browse files
author
Kwesi Rutledge
committed
Added Simple Test of Power Function
1 parent d4d0666 commit 32906ce

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

testing/symbolic/variable_vector_test.go

+30
Original file line numberDiff line numberDiff line change
@@ -1458,3 +1458,33 @@ func TestVariableVector_String1(t *testing.T) {
14581458
}
14591459
}
14601460
}
1461+
1462+
/*
1463+
TestVariableVector_Power1
1464+
Description:
1465+
1466+
Verifies that the Power method returns a MonomialVector object when
1467+
computing a power >= 2 for a well-defined variable vector.
1468+
*/
1469+
func TestVariableVector_Power1(t *testing.T) {
1470+
// Constants
1471+
vv := symbolic.NewVariableVector(1)
1472+
1473+
// Test
1474+
r := vv.Power(2)
1475+
rAsVV, ok := r.(symbolic.Monomial)
1476+
if !ok {
1477+
t.Errorf(
1478+
"Expected vv.Power(2) to return a MonomialVector object; received %T",
1479+
r,
1480+
)
1481+
}
1482+
1483+
if rAsVV.Dims()[0] != 1 {
1484+
t.Errorf(
1485+
"Expected r to have length 1; received %v",
1486+
rAsVV.Dims()[0],
1487+
)
1488+
}
1489+
1490+
}

0 commit comments

Comments
 (0)