latest.ipv8.test.attestation.wallet.primitives.test_value

Module Contents

Classes

TestFP2Value

Tests related to p^2-Galois field values.

class latest.ipv8.test.attestation.wallet.primitives.test_value.TestFP2Value(methodName: str = 'runTest')

Bases: latest.ipv8.test.base.TestBase

Tests related to p^2-Galois field values.

test_add_unary() None

Check if 2 + 5 = 7 mod 11 mod x^2 + x + 1.

test_add_unary_mod() None

Check if 5 + 7 = 1 mod 11 mod x^2 + x + 1.

test_add_x() None

Check if 2x + 5x = 7x mod 11 mod x^2 + x + 1.

test_add_x_mod() None

Check if 5x + 7x = 1x mod 11 mod x^2 + x + 1.

test_add_x2_mod() None

Check if x^2 + x^2 = 9x + 9 mod 11 mod x^2 + x + 1.

test_add_combined_mod() None

Check if x^2 + 5x + 5 + x^2 + 7x + 7 = 10x + 10 mod 11 mod x^2 + x + 1.

test_sub_unary() None

Check if 5 - 2 = 3 mod 11 mod x^2 + x + 1.

test_sub_unary_mod() None

Check if 2 - 5 = 8 mod 11 mod x^2 + x + 1.

test_sub_x() None

Check if 5x - 2x = 3x mod 11 mod x^2 + x + 1.

test_sub_x_mod() None

Check if 2x + 5x = 8x mod 11 mod x^2 + x + 1.

test_sub_x2_mod() None

Check if x^2 - (x^2 + 1) = 10 mod 11 mod x^2 + x + 1.

test_sub_combined_mod() None

Check if x^2 + 5x + 5 - (x^2 + 7x + 7) = 9x + 9 mod 11 mod x^2 + x + 1.

test_mul_unary() None

Check if 2 * 5 = 10 mod 11 mod x^2 + x + 1.

test_mul_unary_mod() None

Check if 3 * 5 = 4 mod 11 mod x^2 + x + 1.

test_mul_x() None

Check if 2x * 5x = 10x^2 mod 11 mod x^2 + x + 1.

test_mul_x_mod() None

Check if 3x * 5x = 4x^2 = 7x + 7 mod 11 mod x^2 + x + 1.

test_mul_combined_mod() None

Check if (5) * (x^2 + x + 1) = 5x^2 + 5x + 5 = 0 mod 11 mod x^2 + x + 1.

test_div_unary() None

Check if 9 / 3 = 3 mod 11 mod x^2 + x + 1.

test_div_unary_mod() None

Check if 4 / 3 = 5 mod 11 mod x^2 + x + 1.

test_div_x() None

Check if 9x / 3x = 3 mod 11 mod x^2 + x + 1.

test_div_x_mod() None

Check if 4x / 3x = 5 mod 11 mod x^2 + x + 1.

test_div_combined_mod() None

Check if (x^2 + 2x + 1) / (x + 1) = x + 1 mod 11 mod x^2 + x + 1.

test_intpow_unary_p2() None

Check if 2^2 = 4 mod 11 mod x^2 + x + 1.

test_intpow_unary_p3() None

Check if 2^3 = 8 mod 11 mod x^2 + x + 1.

test_intpow_unary_p4_mod() None

Check if 2^4 = 5 mod 11 mod x^2 + x + 1.

test_intpow_x_p2() None

Check if x^2 = x^2 mod 11 mod x^2 + x + 1.

test_intpow_combined_p2() None

Check if (x + 1)^2 = x^2 + 2x + 1 mod 11 mod x^2 + x + 1.

test_intpow_negative() None

Check if (16)^-2 = 8 mod 23 mod x^2 + x + 1.

test_inverse() None

Check if (4/3)^-1 = 3/4 mod 11 mod x^2 + x + 1.

test_inverse_normalized() None

Check if (4/3)^-1 = 9 mod 11 mod x^2 + x + 1.

test_wp_compress_simple() None

Check if (2 + 4x)/(1 + 2x) = 2 mod 11 mod x^2 + x + 1.

test_wp_compress_complex() None

Check if (2 + 6x)/(1 + 2x) = 7 + 8x mod 11 mod x^2 + x + 1.

test_str_zero() None

Check if (0x^2 + 0x + 0)/(0x^2 + 0x + 1) is formatted as “0”.

test_str_nozero() None

Check if (0x^2 + x + 0)/(0x^2 + 0x + 1) is formatted as “x”.

test_str_nozero_div() None

Check if (0x^2 + x + 0)/(0x^2 + 0x + 2) is formatted as “(x)/(2)”.

test_str_positive_coefficient() None

Check if (0x^2 + 2x + 0)/(0x^2 + 0x + 1) is formatted as “2x”.

test_eq_other() None

Check if an FP2Value doesn’t magically equal some unrelated object.