diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index b056192..d45aa99 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -49,5 +49,47 @@ jobs: run: | pip install networkx[default] pip install lark - - name: test parsing.py - run: PYTHONPATH="./" python ./tests/scripts/parsing.py \ No newline at end of file + - name: test divz + run: PYTHONPATH="./" python ./tests/scripts/test-divz.py + + detector-test-infoleak: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: install dependencies + run: | + pip install networkx[default] + pip install lark + - name: test infoleak + run: PYTHONPATH="./" python ./tests/scripts/test-infoleak.py + + detector-test-rtcnst: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: install dependencies + run: | + pip install networkx[default] + pip install lark + - name: test rtcnst + run: PYTHONPATH="./" python ./tests/scripts/test-rtcnst.py + + detector-test-unused: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: install dependencies + run: | + pip install networkx[default] + pip install lark + - name: test unused + run: PYTHONPATH="./" python ./tests/scripts/test-unused.py \ No newline at end of file diff --git a/tests/scripts/test-divz.py b/tests/scripts/test-divz.py index 4aea86b..0f17179 100644 --- a/tests/scripts/test-divz.py +++ b/tests/scripts/test-divz.py @@ -8,4 +8,4 @@ main = env.main fid = "ex0" res, info = detector_divz(env, main.id, fid) - assert not res, f"Test failed for {fid}, expected: True, got: {res}" \ No newline at end of file + assert res, f"Test failed for {fid}, expected: True, got: {res}" \ No newline at end of file diff --git a/tests/scripts/test-infoleak.py b/tests/scripts/test-infoleak.py new file mode 100644 index 0000000..be202e0 --- /dev/null +++ b/tests/scripts/test-infoleak.py @@ -0,0 +1,11 @@ +from vanguard.aleo.grammar import AleoEnvironment +from vanguard.aleo.detectors.infoleak import detector_infoleak + +if __name__ == "__main__": + project_name = "infoleak0" + build_path = f"./tests/public/{project_name}/build/" + env = AleoEnvironment(build_path) + main = env.main + fid = "ex0" + res, info = detector_infoleak(env, main.id, fid) + assert res, f"Test failed for {fid}, expected: True, got: {res}" \ No newline at end of file diff --git a/tests/scripts/test-rtcnst.py b/tests/scripts/test-rtcnst.py new file mode 100644 index 0000000..eff5a22 --- /dev/null +++ b/tests/scripts/test-rtcnst.py @@ -0,0 +1,11 @@ +from vanguard.aleo.grammar import AleoEnvironment +from vanguard.aleo.detectors.rtcnst import detector_rtcnst + +if __name__ == "__main__": + project_name = "rtcnst0" + build_path = f"./tests/public/{project_name}/build/" + env = AleoEnvironment(build_path) + main = env.main + fid = "ex0" + res, info = detector_rtcnst(env, main.id, fid) + assert res, f"Test failed for {fid}, expected: True, got: {res}" \ No newline at end of file diff --git a/tests/scripts/test-unused.py b/tests/scripts/test-unused.py new file mode 100644 index 0000000..c907b7c --- /dev/null +++ b/tests/scripts/test-unused.py @@ -0,0 +1,16 @@ +from vanguard.aleo.grammar import AleoEnvironment +from vanguard.aleo.detectors.unused import detector_unused + +if __name__ == "__main__": + project_name = "unused0" + build_path = f"./tests/public/{project_name}/build/" + env = AleoEnvironment(build_path) + main = env.main + + fid = "ex0" + res, info = detector_unused(env, main.id, fid) + assert not res, f"Test failed for {fid}, expected: True, got: {res}" + + fid = "ex1" + res, info = detector_unused(env, main.id, fid) + assert res, f"Test failed for {fid}, expected: True, got: {res}" \ No newline at end of file