14 lines
287 B
Python
14 lines
287 B
Python
from walsh.walsh import nonlinearity
|
|
|
|
|
|
def test_nonlinearity_linear_function():
|
|
assert nonlinearity("x1 XOR x2") == 0
|
|
|
|
|
|
def test_nonlinearity_or():
|
|
assert nonlinearity("x1 OR x2") == 1
|
|
|
|
|
|
def test_nonlinearity_majority():
|
|
assert nonlinearity("x1*x2 XOR x1*x3 XOR x2*x3") == 2
|