Power
- Nada program
- Test file
src/power.py
from nada_dsl import *
def nada_main():
party_alice = Party(name="Alice")
party_bob = Party(name="Bob")
party_charlie = Party(name="Charlie")
base = PublicInteger(Input(name="base", party=party_alice))
exponent = PublicInteger(Input(name="exponent", party=party_bob))
power = base ** exponent
return [Output(power, "power", party_charlie)]
tests/power_test.yaml
---
program: power
inputs:
exponent: 2
base: 4
expected_outputs:
power: 16
Run and test the power program
1. Open "Nada by Example"
2. Run the program with inputs
from the test file
nada run power_test
3. Test the program with inputs
from the test file against the expected_outputs
from the test file
nada test power_test