Reveal
- Nada program
- Test file
src/reveal.py
from nada_dsl import *
def nada_main():
party = Party(name="Alice")
num = SecretInteger(Input(name="favorite_number", party=party))
base = num.to_public()
# power operations can only be performed on public integers, so the input needs to be revealed
num_squared = base ** Integer(2)
return [Output(num_squared, "num_squared", party)]
tests/reveal_test.yaml
---
program: reveal
inputs:
favorite_number: 6
expected_outputs:
num_squared: 36
Run and test the reveal program
1. Open "Nada by Example"
2. Run the program with inputs
from the test file
nada run reveal_test
3. Test the program with inputs
from the test file against the expected_outputs
from the test file
nada test reveal_test