Subtraction
- Nada program
- Test file
src/subtraction.py
from nada_dsl import *
def nada_main():
party_alice = Party(name="Alice")
party_bob = Party(name="Bob")
party_charlie = Party(name="Charlie")
num_1 = SecretInteger(Input(name="num_1", party=party_alice))
num_2 = SecretInteger(Input(name="num_2", party=party_bob))
difference = num_1 - num_2
return [Output(difference, "difference", party_charlie)]
tests/subtraction_test.yaml
---
program: subtraction
inputs:
num_2: 3
num_1: 13
expected_outputs:
difference: 10
Run and test the subtraction program
1. Open "Nada by Example"
2. Run the program with inputs
from the test file
nada run subtraction_test
3. Test the program with inputs
from the test file against the expected_outputs
from the test file
nada test subtraction_test