Multiplication
- Nada program
- Test file
src/multiplication.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))
product = num_1 * num_2
return [Output(product, "product", party_charlie)]
tests/multiplication_test.yaml
---
program: multiplication
inputs:
num_1: 3
num_2: -2
expected_outputs:
product: -6
Run and test the multiplication program
1. Open "Nada by Example"
2. Run the program with inputs
from the test file
nada run multiplication_test
3. Test the program with inputs
from the test file against the expected_outputs
from the test file
nada test multiplication_test