forked from whetstoneresearch/doppler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestScenarios.sh
executable file
·106 lines (89 loc) · 3.06 KB
/
TestScenarios.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
# Function to run tests with current environment configuration
run_test() {
echo "Running tests with configuration:"
echo "IS_TOKEN_0=${IS_TOKEN_0}"
echo "USING_ETH=${USING_ETH}"
echo "FEE=${FEE}"
echo "PROTOCOL_FEE=${PROTOCOL_FEE}"
echo "----------------------------------------"
# Export the variables
export IS_TOKEN_0
export USING_ETH
export FEE
export PROTOCOL_FEE
# Run forge test and capture exit code
forge test --fuzz-runs 65536
local test_result=$?
echo "----------------------------------------"
if [ $test_result -eq 0 ]; then
echo "✅ Tests passed"
else
echo "❌ Tests failed"
fi
echo "----------------------------------------"
echo ""
return $test_result
}
# Initialize with default values
IS_TOKEN_0="false"
USING_ETH="false"
FEE=0
PROTOCOL_FEE=0
# Array to track failed configurations
failed_configs=()
# Test Case 1: IS_TOKEN_0 = true
echo "🔍 Test Case 1: IS_TOKEN_0 = true"
IS_TOKEN_0="true"
run_test || failed_configs+=("Case 1: IS_TOKEN_0=true")
# Test Case 2: IS_TOKEN_0 = false
echo "🔍 Test Case 2: IS_TOKEN_0 = false"
IS_TOKEN_0="false"
run_test || failed_configs+=("Case 2: IS_TOKEN_0=false")
# Test Case 3: USING_ETH = true
echo "🔍 Test Case 3: USING_ETH = true"
USING_ETH="true"
run_test || failed_configs+=("Case 3: USING_ETH=true")
# Test Case 4: IS_TOKEN_0=true and FEE=30
echo "🔍 Test Case 4: IS_TOKEN_0=true and FEE=30"
IS_TOKEN_0="true"
USING_ETH="false"
FEE=30
run_test || failed_configs+=("Case 4: IS_TOKEN_0=true, FEE=30")
# Test Case 5: IS_TOKEN_0=false and FEE=30
echo "🔍 Test Case 5: IS_TOKEN_0=false and FEE=30"
IS_TOKEN_0="false"
FEE=30
run_test || failed_configs+=("Case 5: IS_TOKEN_0=false, FEE=30")
# Test Case 6: USING_ETH=true, IS_TOKEN_0=false and FEE=30
echo "🔍 Test Case 6: USING_ETH=true, IS_TOKEN_0=false and FEE=30"
USING_ETH="true"
IS_TOKEN_0="false"
FEE=30
run_test || failed_configs+=("Case 6: USING_ETH=true, IS_TOKEN_0=false and FEE=30")
# Test Case 7: IS_TOKEN_0=true, FEE=30, PROTOCOL_FEE=50
echo "🔍 Test Case 7: IS_TOKEN_0=true, FEE=30, PROTOCOL_FEE=50"
USING_ETH="false"
IS_TOKEN_0="true"
FEE=30
PROTOCOL_FEE=50
run_test || failed_configs+=("Case 7: IS_TOKEN_0=true, FEE=30, PROTOCOL_FEE=50")
# Test Case 8: IS_TOKEN_0=false, FEE=30, PROTOCOL_FEE=50
echo "🔍 Test Case 8: IS_TOKEN_0=false, FEE=30, PROTOCOL_FEE=50"
IS_TOKEN_0="false"
run_test || failed_configs+=("Case 8: IS_TOKEN_0=false, FEE=30, PROTOCOL_FEE=50")
# Test Case 9: USING_ETH=true, IS_TOKEN_0=false, FEE=30, PROTOCOL_FEE=50
echo "🔍 Test Case 9: USING_ETH=true, IS_TOKEN_0=false, FEE=30, PROTOCOL_FEE=50"
USING_ETH="true"
IS_TOKEN_0="false"
run_test || failed_configs+=("Case 9: USING_ETH=true, IS_TOKEN_0=false, FEE=30, PROTOCOL_FEE=50")
# Print summary
echo "================ Test Summary ================"
if [ ${#failed_configs[@]} -eq 0 ]; then
echo "✅ All test configurations passed!"
else
echo "❌ The following configurations failed:"
for config in "${failed_configs[@]}"; do
echo " - $config"
done
fi