@@ -653,3 +653,52 @@ TEST(IntegerRelationTest, rangeProductMultdimRangeSwapped) {
653653
654654 EXPECT_TRUE (expected.isEqual (rangeProd));
655655}
656+
657+ TEST (IntegerRelationTest, rangeProductEmptyDomain) {
658+ IntegerRelation r1 =
659+ parseRelationFromSet (" (i, j) : (4*i + 9*j == 0, i >= 0, j >= 0)" , 0 );
660+ IntegerRelation r2 =
661+ parseRelationFromSet (" (k, l) : (2*k + 3*l == 0, k >= 0, l >= 0)" , 0 );
662+ IntegerRelation rangeProd = r1.rangeProduct (r2);
663+ IntegerRelation expected =
664+ parseRelationFromSet (" (i, j, k, l) : (2*k + 3*l == 0, 4*i + 9*j == "
665+ " 0, i >= 0, j >= 0, k >= 0, l >= 0)" ,
666+ 0 );
667+ EXPECT_TRUE (expected.isEqual (rangeProd));
668+ }
669+
670+ TEST (IntegerRelationTest, rangeProductEmptyRange) {
671+ IntegerRelation r1 =
672+ parseRelationFromSet (" (i, j) : (4*i + 9*j == 0, i >= 0, j >= 0)" , 2 );
673+ IntegerRelation r2 =
674+ parseRelationFromSet (" (i, j) : (2*i + 3*j == 0, i >= 0, j >= 0)" , 2 );
675+ IntegerRelation rangeProd = r1.rangeProduct (r2);
676+ IntegerRelation expected =
677+ parseRelationFromSet (" (i, j) : (2*i + 3*j == 0, 4*i + 9*j == "
678+ " 0, i >= 0, j >= 0)" ,
679+ 2 );
680+ EXPECT_TRUE (expected.isEqual (rangeProd));
681+ }
682+
683+ TEST (IntegerRelationTest, rangeProductEmptyDomainAndRange) {
684+ IntegerRelation r1 = parseRelationFromSet (" () : ()" , 0 );
685+ IntegerRelation r2 = parseRelationFromSet (" () : ()" , 0 );
686+ IntegerRelation rangeProd = r1.rangeProduct (r2);
687+ IntegerRelation expected = parseRelationFromSet (" () : ()" , 0 );
688+ EXPECT_TRUE (expected.isEqual (rangeProd));
689+ }
690+
691+ TEST (IntegerRelationTest, rangeProductSymbols) {
692+ IntegerRelation r1 = parseRelationFromSet (
693+ " (i, j)[s] : (2*i + 3*j + s == 0, i >= 0, j >= 0)" , 1 );
694+ IntegerRelation r2 = parseRelationFromSet (
695+ " (i, l)[t] : (3*i + 4*l + t == 0, i >= 0, l >= 0)" , 1 );
696+
697+ IntegerRelation rangeProd = r1.rangeProduct (r2);
698+ IntegerRelation expected = parseRelationFromSet (
699+ " (i, j, k, l)[s, t] : (2*i + 3*j + s == 0, 3*i + 4*l + t == "
700+ " 0, i >= 0, j >= 0, l >= 0)" ,
701+ 1 );
702+
703+ EXPECT_TRUE (expected.isEqual (rangeProd));
704+ }
0 commit comments