Skip to content

Commit 14ec36d

Browse files
committed
Bug fix in polyarithsmallmod tests
1 parent 6fd7cbf commit 14ec36d

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

native/tests/seal/util/polyarithsmallmod.cpp

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -666,24 +666,23 @@ namespace sealtest
666666
SEAL_ALLOCATE_ZERO_GET_COEFF_ITER(result, 4, pool);
667667

668668
Modulus mod(10);
669-
size_t coeff_count = 4;
670669

671-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 0, mod, result);
670+
negacyclic_shift_poly_coeffmod(poly, 4, 0, mod, result);
672671
ASSERT_EQ(0ULL, *result[0]);
673672
ASSERT_EQ(0ULL, *result[1]);
674673
ASSERT_EQ(0ULL, *result[2]);
675674
ASSERT_EQ(0ULL, *result[3]);
676-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 1, mod, result);
675+
negacyclic_shift_poly_coeffmod(poly, 4, 1, mod, result);
677676
ASSERT_EQ(0ULL, *result[0]);
678677
ASSERT_EQ(0ULL, *result[1]);
679678
ASSERT_EQ(0ULL, *result[2]);
680679
ASSERT_EQ(0ULL, *result[3]);
681-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 2, mod, result);
680+
negacyclic_shift_poly_coeffmod(poly, 4, 2, mod, result);
682681
ASSERT_EQ(0ULL, *result[0]);
683682
ASSERT_EQ(0ULL, *result[1]);
684683
ASSERT_EQ(0ULL, *result[2]);
685684
ASSERT_EQ(0ULL, *result[3]);
686-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 3, mod, result);
685+
negacyclic_shift_poly_coeffmod(poly, 4, 3, mod, result);
687686
ASSERT_EQ(0ULL, *result[0]);
688687
ASSERT_EQ(0ULL, *result[1]);
689688
ASSERT_EQ(0ULL, *result[2]);
@@ -693,22 +692,22 @@ namespace sealtest
693692
*poly[1] = 2;
694693
*poly[2] = 3;
695694
*poly[3] = 4;
696-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 0, mod, result);
695+
negacyclic_shift_poly_coeffmod(poly, 4, 0, mod, result);
697696
ASSERT_EQ(1ULL, *result[0]);
698697
ASSERT_EQ(2ULL, *result[1]);
699698
ASSERT_EQ(3ULL, *result[2]);
700699
ASSERT_EQ(4ULL, *result[3]);
701-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 1, mod, result);
700+
negacyclic_shift_poly_coeffmod(poly, 4, 1, mod, result);
702701
ASSERT_EQ(6ULL, *result[0]);
703702
ASSERT_EQ(1ULL, *result[1]);
704703
ASSERT_EQ(2ULL, *result[2]);
705704
ASSERT_EQ(3ULL, *result[3]);
706-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 2, mod, result);
705+
negacyclic_shift_poly_coeffmod(poly, 4, 2, mod, result);
707706
ASSERT_EQ(7ULL, *result[0]);
708707
ASSERT_EQ(6ULL, *result[1]);
709708
ASSERT_EQ(1ULL, *result[2]);
710709
ASSERT_EQ(2ULL, *result[3]);
711-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 3, mod, result);
710+
negacyclic_shift_poly_coeffmod(poly, 4, 3, mod, result);
712711
ASSERT_EQ(8ULL, *result[0]);
713712
ASSERT_EQ(7ULL, *result[1]);
714713
ASSERT_EQ(6ULL, *result[2]);
@@ -718,9 +717,8 @@ namespace sealtest
718717
*poly[1] = 2;
719718
*poly[2] = 3;
720719
*poly[3] = 4;
721-
coeff_count = 2;
722-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 1, mod, result);
723-
negacyclic_shift_poly_coeffmod(poly + 2, coeff_count, 1, mod, result + 2);
720+
negacyclic_shift_poly_coeffmod(poly, 2, 1, mod, result);
721+
negacyclic_shift_poly_coeffmod(poly + 2, 2, 1, mod, result + 2);
724722
ASSERT_EQ(8ULL, *result[0]);
725723
ASSERT_EQ(1ULL, *result[1]);
726724
ASSERT_EQ(6ULL, *result[2]);
@@ -731,7 +729,6 @@ namespace sealtest
731729
SEAL_ALLOCATE_ZERO_GET_RNS_ITER(result, 4, 2, pool);
732730

733731
vector<Modulus> mod{ 10, 11 };
734-
size_t coeff_count = 4;
735732

736733
*poly[0][0] = 1;
737734
*poly[0][1] = 2;
@@ -752,7 +749,7 @@ namespace sealtest
752749
ASSERT_EQ(3ULL, *result[1][2]);
753750
ASSERT_EQ(4ULL, *result[1][3]);
754751

755-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 1, mod, result);
752+
negacyclic_shift_poly_coeffmod(poly, 2, 1, mod, result);
756753
ASSERT_EQ(6ULL, *result[0][0]);
757754
ASSERT_EQ(1ULL, *result[0][1]);
758755
ASSERT_EQ(2ULL, *result[0][2]);
@@ -762,7 +759,7 @@ namespace sealtest
762759
ASSERT_EQ(2ULL, *result[1][2]);
763760
ASSERT_EQ(3ULL, *result[1][3]);
764761

765-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 2, mod, result);
762+
negacyclic_shift_poly_coeffmod(poly, 2, 2, mod, result);
766763
ASSERT_EQ(7ULL, *result[0][0]);
767764
ASSERT_EQ(6ULL, *result[0][1]);
768765
ASSERT_EQ(1ULL, *result[0][2]);
@@ -772,7 +769,7 @@ namespace sealtest
772769
ASSERT_EQ(1ULL, *result[1][2]);
773770
ASSERT_EQ(2ULL, *result[1][3]);
774771

775-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 3, mod, result);
772+
negacyclic_shift_poly_coeffmod(poly, 2, 3, mod, result);
776773
ASSERT_EQ(8ULL, *result[0][0]);
777774
ASSERT_EQ(7ULL, *result[0][1]);
778775
ASSERT_EQ(6ULL, *result[0][2]);
@@ -787,7 +784,6 @@ namespace sealtest
787784
SEAL_ALLOCATE_ZERO_GET_POLY_ITER(result, 2, 4, 2, pool);
788785

789786
vector<Modulus> mod{ 10, 11 };
790-
size_t coeff_count = 4;
791787

792788
*poly[0][0][0] = 1;
793789
*poly[0][0][1] = 2;
@@ -826,7 +822,7 @@ namespace sealtest
826822
ASSERT_EQ(3ULL, *result[1][1][2]);
827823
ASSERT_EQ(4ULL, *result[1][1][3]);
828824

829-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 1, mod, result);
825+
negacyclic_shift_poly_coeffmod(poly, 2, 1, mod, result);
830826
ASSERT_EQ(6ULL, *result[0][0][0]);
831827
ASSERT_EQ(1ULL, *result[0][0][1]);
832828
ASSERT_EQ(2ULL, *result[0][0][2]);
@@ -845,7 +841,7 @@ namespace sealtest
845841
ASSERT_EQ(2ULL, *result[1][1][2]);
846842
ASSERT_EQ(3ULL, *result[1][1][3]);
847843

848-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 2, mod, result);
844+
negacyclic_shift_poly_coeffmod(poly, 2, 2, mod, result);
849845
ASSERT_EQ(7ULL, *result[0][0][0]);
850846
ASSERT_EQ(6ULL, *result[0][0][1]);
851847
ASSERT_EQ(1ULL, *result[0][0][2]);
@@ -864,7 +860,7 @@ namespace sealtest
864860
ASSERT_EQ(1ULL, *result[1][1][2]);
865861
ASSERT_EQ(2ULL, *result[1][1][3]);
866862

867-
negacyclic_shift_poly_coeffmod(poly, coeff_count, 3, mod, result);
863+
negacyclic_shift_poly_coeffmod(poly, 2, 3, mod, result);
868864
ASSERT_EQ(8ULL, *result[0][0][0]);
869865
ASSERT_EQ(7ULL, *result[0][0][1]);
870866
ASSERT_EQ(6ULL, *result[0][0][2]);

0 commit comments

Comments
 (0)