run.sh 3.57 KB
Newer Older
1
#!/usr/bin/env bash
2
3


4
5
6
7
8
9
10
####################
# common script init
if ! test -r ../utils.sh; then
	echo "run executable from its own directory: $0"; exit 1; fi
. ../utils.sh
Z="`detect_zenroom_path` `detect_zenroom_conf`"
####################
11

12
cat <<EOF | zexe array_32_256.zen > arr.json
13
rule output encoding url64
14
15
16
17
18
19
Given nothing
When I create the array of '32' random objects of '256' bits
and I rename the 'array' to 'bonnetjes'
Then print the 'bonnetjes'
EOF

20
cat <<EOF | zexe array_rename_remove.zen -a arr.json
21
22
rule input encoding url64
rule output encoding hex
23
Given I have a 'array' named 'bonnetjes'
Jaromil's avatar
Jaromil committed
24
When I pick the random object in 'bonnetjes'
25
and I rename the 'random object' to 'lucky one'
Jaromil's avatar
Jaromil committed
26
and I remove the 'lucky one' from 'bonnetjes'
27
# redundant check
Jaromil's avatar
Jaromil committed
28
and the 'lucky one' is not found in 'bonnetjes'
29
30
31
Then print the 'lucky one'
EOF

32
cat <<EOF | zexe array_ecp_aggregation.zen > ecp_aggregation.json
33
34
35
36
rule output encoding url64
Given nothing
When I create the array of '32' random curve points
and I rename the 'array' to 'curve points'
Jaromil's avatar
Jaromil committed
37
and I create the aggregation of 'curve points'
38
39
40
Then print the 'aggregation'
EOF

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# cat <<EOF | zexe array_hashtopoint.zen -a arr.json > ecp.json
# rule input encoding url64
# rule output encoding url64
# Given I have a 'array' named 'bonnetjes'
# When I create the hash to point 'ECP' of each object in 'bonnetjes'
# # When for each x in 'bonnetjes' create the of 'ECP.hashtopoint(x)'
# Then print the 'hashes'
# EOF

# cat <<EOF | zexe array_ecp_check.zen -a arr.json -k ecp.json > hashes.json
# rule input encoding url64
# rule output encoding url64
# Given I have a 'array' named 'bonnetjes'
# and I have a 'ecp array' named 'hashes'
# # When I pick the random object in array 'hashes'
# # and I remove the 'random object' from array 'hashes'
# When for each x in 'hashes' y in 'bonnetjes' is true 'x == ECP.hashtopoint(y)'
# Then print the 'hashes'
# EOF
# # 'x == ECP.hashtopoint(y)'
61
62


63
cat <<EOF | zexe left_array_from_hash.zen -a arr.json > left_arr.json
64
65
rule input encoding url64
rule output encoding url64
66
Given I have a 'array' named 'bonnetjes'
67
68
When I create the hashes of each object in 'bonnetjes'
and rename the 'hashes' to 'left array'
69
Then print the 'left array'
70
EOF
71
72
73
74
75
76


cat <<EOF | zexe right_array_from_hash.zen -a arr.json > right_arr.json
rule input encoding url64
rule output encoding url64
Given I have a 'array' named 'bonnetjes'
77
78
When I create the hashes of each object in 'bonnetjes'
and rename the 'hashes' to 'right array'
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Then print the 'right array'
EOF

# comparison

cat <<EOF | zexe array_comparison.zen -a left_arr.json -k right_arr.json
rule input encoding url64
rule output encoding url64
Given I have a 'array' named 'left array'
and I have a 'array' named 'right array'
When I verify 'left array' is equal to 'right array'
Then print 'OK'
EOF

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
cat <<EOF | zexe array_remove_object.zen -a arr.json > right_arr.json
rule input encoding url64
rule output encoding url64
Given I have a 'array' named 'bonnetjes'
When I pick the random object in 'bonnetjes'
and I remove the 'random object' from 'bonnetjes'
and I create the hashes of each object in 'bonnetjes'
and rename the 'hashes' to 'right array'
Then print the 'right array'
EOF

# verify that arrays are not equal
cat <<EOF | zexe array_not_comparison.zen -a left_arr.json -k right_arr.json
rule input encoding url64
rule output encoding url64
Given I have a 'array' named 'left array'
and I have a 'array' named 'right array'
When I verify 'left array' is not equal to 'right array'
Then print 'OK'
EOF
113
114


115
116
117
# 'x == ECP.hashtopoint(y)'


118
119
# When I check 'hashes' and 'bonnetjes'
# When I check 'hashes' and 'bonnetjes' such as