-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from NillionNetwork/feat/nada-test
Add testing examples for addition program using nada-test
- Loading branch information
Showing
3 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
nada-dsl | ||
nada-numpy | ||
nada-test | ||
|
||
# streamlit demo dependencies | ||
pyyaml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |