- static boolean ComparePoly(final int[] expected, final int size, final GF_Poly poly) {
- if (size != poly.degree() + 1) {
- return false;
- }
- for (int i = 0; i < size; ++i) {
- // "expected" is ordered in a reverse order. We reverse the coeff
- // index for comparison.
- final int coeff = GaloisField.GetField(8).Log(
- poly.coeff(size - i - 1));
- if (expected[i] != coeff) {
- Debug.LOG_ERROR("values don't match at " + i + ": " +
- expected[i] + " vs. " + coeff);
- return false;
- }
- }
- return true;
- }
-
- // Numbers are from Appendix A of JISX0510 2004 (p.59).
- public void testGetECPoly() {
- {
- final GF_Poly poly = Encoder.GetECPoly(7);
- final int[] expected = {0, 87, 229, 146, 149, 238, 102, 21};
- assertTrue(ComparePoly(expected, expected.length, poly));
- }
- {
- final GF_Poly poly = Encoder.GetECPoly(17);
- final int[] expected = {
- 0, 43, 139, 206, 78, 43, 239, 123, 206, 214, 147, 24, 99, 150,
- 39, 243, 163, 136
- };
- assertTrue(ComparePoly(expected, expected.length, poly));
- }
- {
- final GF_Poly poly = Encoder.GetECPoly(34);
- final int[] expected = {
- 0, 111, 77, 146, 94, 26, 21, 108, 19,
- 105, 94, 113, 193, 86, 140, 163, 125,
- 58,
- 158, 229, 239, 218, 103, 56, 70, 114,
- 61, 183, 129, 167, 13, 98, 62, 129, 51
- };
- assertTrue(ComparePoly(expected, expected.length, poly));
- }
- {
- final GF_Poly poly = Encoder.GetECPoly(68);
- final int[] expected = {
- 0, 247, 159, 223, 33, 224, 93, 77, 70,
- 90, 160, 32, 254, 43, 150, 84, 101,
- 190,
- 205, 133, 52, 60, 202, 165, 220, 203,
- 151, 93, 84, 15, 84, 253, 173, 160,
- 89, 227, 52, 199, 97, 95, 231, 52,
- 177, 41, 125, 137, 241, 166, 225, 118,
- 2, 54,
- 32, 82, 215, 175, 198, 43, 238, 235,
- 27, 101, 184, 127, 3, 5, 8, 163, 238
- };
- assertTrue(ComparePoly(expected, expected.length, poly));
- }
- }
+ // JAVAPORT: Uncomment and fix up with new Reed Solomon objects
+// static boolean ComparePoly(final int[] expected, final int size, final GF_Poly poly) {
+// if (size != poly.degree() + 1) {
+// return false;
+// }
+// for (int i = 0; i < size; ++i) {
+// // "expected" is ordered in a reverse order. We reverse the coeff
+// // index for comparison.
+// final int coeff = GaloisField.GetField(8).Log(
+// poly.coeff(size - i - 1));
+// if (expected[i] != coeff) {
+// Debug.LOG_ERROR("values don't match at " + i + ": " +
+// expected[i] + " vs. " + coeff);
+// return false;
+// }
+// }
+// return true;
+// }
+//
+// // Numbers are from Appendix A of JISX0510 2004 (p.59).
+// public void testGetECPoly() {
+// {
+// final GF_Poly poly = Encoder.GetECPoly(7);
+// final int[] expected = {0, 87, 229, 146, 149, 238, 102, 21};
+// assertTrue(ComparePoly(expected, expected.length, poly));
+// }
+// {
+// final GF_Poly poly = Encoder.GetECPoly(17);
+// final int[] expected = {
+// 0, 43, 139, 206, 78, 43, 239, 123, 206, 214, 147, 24, 99, 150,
+// 39, 243, 163, 136
+// };
+// assertTrue(ComparePoly(expected, expected.length, poly));
+// }
+// {
+// final GF_Poly poly = Encoder.GetECPoly(34);
+// final int[] expected = {
+// 0, 111, 77, 146, 94, 26, 21, 108, 19,
+// 105, 94, 113, 193, 86, 140, 163, 125,
+// 58,
+// 158, 229, 239, 218, 103, 56, 70, 114,
+// 61, 183, 129, 167, 13, 98, 62, 129, 51
+// };
+// assertTrue(ComparePoly(expected, expected.length, poly));
+// }
+// {
+// final GF_Poly poly = Encoder.GetECPoly(68);
+// final int[] expected = {
+// 0, 247, 159, 223, 33, 224, 93, 77, 70,
+// 90, 160, 32, 254, 43, 150, 84, 101,
+// 190,
+// 205, 133, 52, 60, 202, 165, 220, 203,
+// 151, 93, 84, 15, 84, 253, 173, 160,
+// 89, 227, 52, 199, 97, 95, 231, 52,
+// 177, 41, 125, 137, 241, 166, 225, 118,
+// 2, 54,
+// 32, 82, 215, 175, 198, 43, 238, 235,
+// 27, 101, 184, 127, 3, 5, 8, 163, 238
+// };
+// assertTrue(ComparePoly(expected, expected.length, poly));
+// }
+// }