diff --git a/test/test_funcs.py b/test/test_funcs.py new file mode 100644 index 0000000..793fb75 --- /dev/null +++ b/test/test_funcs.py @@ -0,0 +1,8 @@ +import os, sys +from mpmath import * + +THIS_FOLDER = os.path.dirname(os.path.abspath(__file__)) + "/.." +sys.path.insert(1, THIS_FOLDER) + +from flax.funcs import * + diff --git a/test/test_monads.py b/test/test_monads.py index cc02f21..27767ca 100644 --- a/test/test_monads.py +++ b/test/test_monads.py @@ -1,4 +1,3 @@ -# single byte monads import os, sys from mpmath import * @@ -8,45 +7,45 @@ from flax.main import flax_run as run -def test_abs(): # A +def test_A(): assert run("A") == 0 assert run("A", -3) == 3 assert run("A", 3) == 3 -def test_any(): # Ȧ +def test_Adot(): # Ȧ assert run("Ȧ") == 0 assert run("Ȧ", [0] * 10) == 0 assert run("Ȧ", [0, 0, 1, 0, 0]) == 1 assert run("Ȧ", [1, 2]) == 1 -def test_i2b(): # B +def test_B(): # B assert run("B") == [0] assert run("B", 12) == [1, 1, 0, 0] assert run("B", -6) == [-1, -1, 0] assert run("B", [5, -3, 10]) == [[1, 0, 1], [-1, -1], [1, 0, 1, 0]] -def test_b2i(): # Ḃ +def test_Bdot(): # Ḃ assert run("Ḃ") == 0 assert run("Ḃ", [1, 1, 0]) == 6 assert run("Ḃ", [-1, -1, -1]) == -7 assert run("Ḃ", [[1, 0, 1, 1], [1, 0, 1]]) == [11, 5] -def test_complement(): # C +def test_C(): # C assert run("C") == 1 assert run("C", 1) == 0 assert run("C", 10) == -9 assert run("C", [10, -10, [4]]) == [-9, 11, [-3]] -def test_randomly_choose(): # Ċ +def test_Cdot(): # Ċ assert run("Ċ", [1, 2, 3]) in [1, 2, 3] -def test_i2d(): # D +def test_D(): # D assert run("D") == [0] assert run("D", 2) == [2] assert run("D", 234) == [2, 3, 4] @@ -54,39 +53,39 @@ def test_i2d(): # D assert run("D", [-45, 45]) == [[-4, -5], [4, 5]] -def test_d2i(): # Ḋ +def test_Ddot(): # Ḋ assert run("Ḋ") == 0 assert run("Ḋ", [1, 2]) == 12 assert run("Ḋ", [-6, -9]) == -69 assert run("Ḋ", [[2, 3, 1], [-5, -3]]) == [231, -53] -def test_alleq(): # E +def test_E(): # E assert run("E", [1, 2, 3]) == 0 assert run("E", [2, 2, 2]) == 1 assert run("E", [[1, 2], [1, 2]]) == 1 -def test_aleq_r(): # Ė +def test_Edot(): # Ė assert run("Ė", [1, 2, 3]) == [] assert run("Ė", [2, 2, 2]) == 2 assert run("Ė", [[1, 2], [1, 2]]) == [1, 2] -def test_flatten(): # F +def test_F(): # F assert run("F") == [0] assert run("F", [1, 2]) == [1, 2] assert run("F", [[[[1]]]]) == [1] assert run("F", [1, 2, [3, 4, [5], [[6]]], []]) == [1, 2, 3, 4, 5, 6] -def test_falsey_indicies(): # Ḟ +def test_Fdot(): # Ḟ assert run("Ḟ") == [0] assert run("Ḟ", [1, 2]) == [] assert run("Ḟ", [1, 0, 2]) == [1] assert run("Ḟ", [0, 3, 2, 1, 0, 0]) == [0, 4, 5] -def test_group_indicies(): # G +def test_G(): # G assert run("G", [0]) == [[0]] assert run("G", [0, 1, 0, 0, 1]) == [[0, 2, 3], [1, 4]] diff --git a/test/test_syntax.py b/test/test_syntax.py index e49a693..4434a0f 100644 --- a/test/test_syntax.py +++ b/test/test_syntax.py @@ -1,5 +1,3 @@ -# test syntax things and chain separators -# and niladic atoms import os, sys from mpmath import *