Skip to content

Commit 114a989

Browse files
committed
split test
1 parent 8e420b1 commit 114a989

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/test/java/de/tilman_neumann/jml/quadraticResidues/QuadraticResiduesTest.java

+14-10
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,33 @@ public void testSetOfQuadraticResidues() {
5050

5151
/**
5252
* Test the number of quadratic residues modulo 2^n for n = 0, 1, 2, ...
53-
* This gives number sequences
54-
* A023105(n) = 1, 2, 2, 3, 4, 7, 12, 23, 44, 87, 172, 343, ... for general quadratic residues modulo 2^n, and
55-
* a(n) = {1, 1} + A023105(n-2) = 1, 1, 1, 2, 2, 3, 4, 7, 12, 23, 44, 87, 172, 343, 684, 1367, 2732, 5463, 10924, 21847, ... for "even" quadratic residues modulo 2^n.
56-
*/
53+
* This gives number sequence A023105(n) = 1, 2, 2, 3, 4, 7, 12, 23, 44, 87, 172, 343, ... */
5754
@Test
5855
public void testQuadraticResiduesMod2PowNCounts() {
5956
ArrayList<Integer> counts = new ArrayList<Integer>();
60-
ArrayList<Integer> evenCounts = new ArrayList<Integer>();
61-
6257
for (int n=0; n<20; n++) {
6358
int m = 1<<n;
64-
6559
TreeSet<Long> quadraticResiduesMod2PowN = QuadraticResidues.getQuadraticResidues(m);
6660
if (DEBUG) LOG.debug("m = " + m + " has " + quadraticResiduesMod2PowN.size() + " quadratic residues: " + quadraticResiduesMod2PowN);
6761
counts.add(quadraticResiduesMod2PowN.size());
62+
}
63+
LOG.info("counts = " + counts);
64+
assertEquals("[1, 2, 2, 3, 4, 7, 12, 23, 44, 87, 172, 343, 684, 1367, 2732, 5463, 10924, 21847, 43692, 87383]", counts.toString());
65+
}
6866

67+
/**
68+
* Test the number of even quadratic residues modulo 2^n for n = 0, 1, 2, ...
69+
* This gives number sequence a(n) = {1, 1} + A023105(n-2) = 1, 1, 1, 2, 2, 3, 4, 7, 12, 23, 44, 87, 172, 343, 684, 1367, 2732, 5463, 10924, 21847, ...
70+
*/
71+
@Test
72+
public void testEvenQuadraticResiduesMod2PowNCounts() {
73+
ArrayList<Integer> evenCounts = new ArrayList<Integer>();
74+
for (int n=0; n<20; n++) {
75+
int m = 1<<n;
6976
TreeSet<Long> evenQuadraticResiduesMod2PowN = QuadraticResidues.getEvenQuadraticResidues(m);
7077
if (DEBUG) LOG.debug("m = " + m + " has " + evenQuadraticResiduesMod2PowN.size() + " 'even' quadratic residues: " + evenQuadraticResiduesMod2PowN);
7178
evenCounts.add(evenQuadraticResiduesMod2PowN.size());
7279
}
73-
74-
LOG.info("counts = " + counts);
75-
assertEquals("[1, 2, 2, 3, 4, 7, 12, 23, 44, 87, 172, 343, 684, 1367, 2732, 5463, 10924, 21847, 43692, 87383]", counts.toString());
7680
LOG.info("evenCounts = " + evenCounts);
7781
assertEquals("[1, 1, 1, 2, 2, 3, 4, 7, 12, 23, 44, 87, 172, 343, 684, 1367, 2732, 5463, 10924, 21847]", evenCounts.toString());
7882
}

0 commit comments

Comments
 (0)