summaryrefslogtreecommitdiff
path: root/test/rust/cargo/circle/verify.py
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-06-27 12:25:35 +0200
committerGitHub <noreply@github.com>2024-06-27 12:25:35 +0200
commit05b2d6fc51146fe07340a58bc87fbbd99e788143 (patch)
tree2c607815866fdb7887dc5486255d2a7729f23578 /test/rust/cargo/circle/verify.py
parent7dc9a7b9107b2607e9870d7fc92fb2d40505f7ef (diff)
parentc6b35f8f2e83621b4e53ab999e5b5bf146a73aa0 (diff)
downloadhello-nix-05b2d6fc51146fe07340a58bc87fbbd99e788143.tar.gz
Merge pull request #3 from aehlig/cargo-example
Add example on how to use cargo
Diffstat (limited to 'test/rust/cargo/circle/verify.py')
-rw-r--r--test/rust/cargo/circle/verify.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/rust/cargo/circle/verify.py b/test/rust/cargo/circle/verify.py
new file mode 100644
index 0000000..09dccee
--- /dev/null
+++ b/test/rust/cargo/circle/verify.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python3
+
+import math
+import sys
+
+with open(sys.argv[1]) as f:
+ samples = f.read()
+
+for line in samples.splitlines():
+ xs, ys = line.split()
+ x = int(xs)
+ y = int(ys)
+ radius = math.sqrt(x*x + y*y)
+ print ("(%+3d,%+3d) -> %4.1f" % (x,y,radius))
+ if radius > 100.0:
+ sys.exit(1)