Skip to content

Commit

Permalink
Merge pull request #30 from NillionNetwork/feat/nada-test
Browse files Browse the repository at this point in the history
Add testing examples for addition program using nada-test
  • Loading branch information
oceans404 authored Sep 4, 2024
2 parents 3818629 + 7747459 commit b03bbcf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nada-project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name = "nada-by-example"
version = "0.1.0"
authors = [""]

[test_framework.nada-test]
command = "nada-test ./tests"

[[programs]]
path = "src/main.py"
prime_size = 128
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
nada-dsl
nada-numpy
nada-test

# streamlit demo dependencies
pyyaml
Expand Down
20 changes: 20 additions & 0 deletions tests/addition_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# These tests use the nada-test testing framework
from nada_test import nada_test, NadaTest

# Functional style addition test
@nada_test(program="addition")
def addition_test_functional():
num_1 = 30
num_2 = 10
inputs = {"num_1": num_1, "num_2": num_2}
outputs = yield inputs
assert outputs["sum"] == num_1 + num_2

# Class style addition test
@nada_test(program="addition")
class Test(NadaTest):
def inputs(self):
return {"num_1": 30, "num_2": 10}

def check(self, outputs):
assert outputs["sum"] == 40

0 comments on commit b03bbcf

Please sign in to comment.