-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick_test.sh
More file actions
executable file
·98 lines (85 loc) · 2.75 KB
/
quick_test.sh
File metadata and controls
executable file
·98 lines (85 loc) · 2.75 KB
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
#!/bin/bash
# Quick Test Script for CompZ
# Tests all core functionality in 1 minute
echo "=============================================================="
echo "CompZ - Quick Functionality Test"
echo "=============================================================="
echo ""
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m'
TESTS_PASSED=0
TESTS_FAILED=0
run_test() {
local test_name="$1"
local command="$2"
echo -n "Testing: $test_name... "
if eval "$command" > /dev/null 2>&1; then
echo -e "${GREEN}✅ PASS${NC}"
((TESTS_PASSED++))
return 0
else
echo -e "${RED}❌ FAIL${NC}"
((TESTS_FAILED++))
return 1
fi
}
echo "1. Installation Tests"
echo "----------------------"
run_test "CompZ installed" "python3 -c 'import compz'"
run_test "CLI accessible" "compz version"
echo ""
echo "2. Core Functionality Tests"
echo "----------------------------"
run_test "Normalization" "python3 -c 'from compz.normalize import normalize_json; normalize_json({\"a\":1})'"
run_test "Hashing" "python3 -c 'from compz.hash import hash_compliance; hash_compliance({\"a\":1})'"
run_test "Memo creation" "python3 -c 'from compz.hash import create_memo; create_memo(\"0xabc\")'"
run_test "Client init" "python3 -c 'from compz import CompZClient; CompZClient()'"
echo ""
echo "3. CLI Tests"
echo "------------"
run_test "CLI status" "compz status"
run_test "CLI version" "compz version"
echo ""
echo "4. Demo Tests"
echo "-------------"
echo "Running tamper detection demo..."
if python3 examples/tamper_detection_demo.py > /tmp/compz_test.log 2>&1; then
echo -e "${GREEN}✅ Tamper detection demo: PASS${NC}"
((TESTS_PASSED++))
else
echo -e "${RED}❌ Tamper detection demo: FAIL${NC}"
((TESTS_FAILED++))
fi
echo ""
echo "=============================================================="
echo "Test Results"
echo "=============================================================="
echo ""
echo -e "Tests Passed: ${GREEN}$TESTS_PASSED${NC}"
echo -e "Tests Failed: ${RED}$TESTS_FAILED${NC}"
echo ""
if [ $TESTS_FAILED -eq 0 ]; then
echo -e "${GREEN}✅ All tests passed! CompZ is working correctly.${NC}"
echo ""
echo "Next steps:"
echo "1. For full blockchain integration:"
echo " ./scripts/setup_testnet.sh"
echo ""
echo "2. Read the testing guide:"
echo " cat TESTING_GUIDE.md"
echo ""
echo "3. Try the examples:"
echo " cd examples && python3 self_hosted_example.py"
exit 0
else
echo -e "${RED}❌ Some tests failed. Check installation.${NC}"
echo ""
echo "Troubleshooting:"
echo "1. Reinstall: pip install -e ."
echo "2. Check dependencies: pip install -r requirements.txt"
echo "3. See TESTING_GUIDE.md for details"
exit 1
fi