Division
- Nada program
- Test file
src/division.py
from nada_dsl import *
def nada_main():
party_alice = Party(name="Alice")
party_bob = Party(name="Bob")
party_charlie = Party(name="Charlie")
numerator = SecretInteger(Input(name="numerator", party=party_alice))
denominator = SecretInteger(Input(name="denominator", party=party_bob))
quotient = numerator / denominator
return [Output(quotient, "quotient", party_charlie)]
tests/division_test.yaml
---
program: division
inputs:
numerator: 20
denominator: 4
expected_outputs:
quotient: 5
Run and test the division program
1. Open "Nada by Example"
2. Run the program with inputs
from the test file
nada run division_test
3. Test the program with inputs
from the test file against the expected_outputs
from the test file
nada test division_test