Modulo
- Nada program
- Test file
src/modulo.py
from nada_dsl import *
def nada_main():
party_alice = Party(name="Alice")
party_bob = Party(name="Bob")
party_charlie = Party(name="Charlie")
dividend = SecretInteger(Input(name="dividend", party=party_alice))
divisor = SecretInteger(Input(name="divisor", party=party_bob))
# modulo
remainder = dividend % divisor
return [Output(remainder, "remainder", party_charlie)]
tests/modulo_test.yaml
---
program: modulo
inputs:
dividend: 10
divisor: 3
expected_outputs:
remainder: 1
Run and test the modulo program
1. Open "Nada by Example"
2. Run the program with inputs
from the test file
nada run modulo_test
3. Test the program with inputs
from the test file against the expected_outputs
from the test file
nada test modulo_test