mirror of
https://github.com/zama-ai/concrete.git
synced 2026-01-10 05:18:00 -05:00
test(frontend): test TFHE-rs example
This commit is contained in:
committed by
Quentin Bourgerie
parent
061715cfe4
commit
1ecaa5b033
19
frontends/concrete-python/examples/tfhers/test.sh
Executable file
19
frontends/concrete-python/examples/tfhers/test.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This file tests that the example is working
|
||||
|
||||
shell_blocks=$(sed -n '/^```sh/,/^```/ p' < README.md | sed '/^```sh/d' | sed '/^```/d')
|
||||
|
||||
set -e
|
||||
output=$(eval "$shell_blocks" 2>&1) || echo "$output"
|
||||
|
||||
result=$(echo "$output" | grep "result: " | sed 's/result: //g')
|
||||
|
||||
expected="31"
|
||||
if [ $result -eq $expected ]
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
echo "expected result to be $expected, but result was $result"
|
||||
exit 1
|
||||
fi
|
||||
@@ -2,6 +2,7 @@
|
||||
Tests of the examples.
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
import numpy as np
|
||||
@@ -404,3 +405,13 @@ Actual Output
|
||||
{actual_output}
|
||||
|
||||
"""
|
||||
|
||||
|
||||
def test_tfhers_example():
|
||||
path_to_test_script = tfhers_utils = (
|
||||
f"{os.path.dirname(os.path.abspath(__file__))}/../../examples/tfhers/"
|
||||
)
|
||||
test_script_filename = "test.sh"
|
||||
assert (
|
||||
os.system(f"cd {path_to_test_script} && sh {test_script_filename}") == 0
|
||||
), "test script failed"
|
||||
|
||||
Reference in New Issue
Block a user