Skip to content

Commit abb5eb7

Browse files
Jim8yclaude
andcommitted
fix: Fix all compilation errors and enable full test suite
- Fix test_console_service: Use public OnCommand() instead of protected methods - Fix shadow warnings in transaction_verifier.h by using different parameter names - Update workflow to build and run ALL tests now that compilation is fixed - Enable full parallel builds and comprehensive test execution All unit tests should now compile and run successfully. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 14dbd88 commit abb5eb7

File tree

3 files changed

+15
-41
lines changed

3 files changed

+15
-41
lines changed

.github/workflows/c-cpp.yml

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,10 @@ jobs:
5656
# Build core library first
5757
cmake --build build --target neo_cpp --parallel 4
5858
59-
- name: Build Working Tests
59+
- name: Build All Tests
6060
run: |
61-
# Build tests that we know compile successfully
62-
cmake --build build --target simple_unit_test --parallel 4 || true
63-
cmake --build build --target test_cryptography --parallel 4 || true
64-
cmake --build build --target test_io --parallel 4 || true
65-
cmake --build build --target test_json --parallel 4 || true
66-
cmake --build build --target test_persistence --parallel 4 || true
61+
# Build all tests - the fixes should allow them to compile
62+
cmake --build build --parallel $(nproc)
6763
6864
- name: List All Built Tests
6965
working-directory: build
@@ -75,35 +71,12 @@ jobs:
7571
echo "=== All test executables built ==="
7672
find . -name "*test*" -type f -executable -not -path "*/CMakeFiles/*" | sort
7773
78-
- name: Run Available Tests
74+
- name: Run All Tests
7975
working-directory: build
8076
run: |
81-
echo "=== Running available tests ==="
82-
# Run each test that was successfully built
83-
if [ -f "./tests/simple_unit_test" ]; then
84-
echo "Running simple_unit_test..."
85-
./tests/simple_unit_test || echo "simple_unit_test failed"
86-
fi
87-
88-
if [ -f "./tests/unit/cryptography/test_cryptography" ]; then
89-
echo "Running test_cryptography..."
90-
./tests/unit/cryptography/test_cryptography || echo "test_cryptography failed"
91-
fi
92-
93-
if [ -f "./tests/unit/io/test_io" ]; then
94-
echo "Running test_io..."
95-
./tests/unit/io/test_io || echo "test_io failed"
96-
fi
97-
98-
if [ -f "./tests/unit/json/test_json" ]; then
99-
echo "Running test_json..."
100-
./tests/unit/json/test_json || echo "test_json failed"
101-
fi
102-
103-
if [ -f "./tests/unit/persistence/test_persistence" ]; then
104-
echo "Running test_persistence..."
105-
./tests/unit/persistence/test_persistence || echo "test_persistence failed"
106-
fi
77+
echo "=== Running all tests with CTest ==="
78+
# Run all tests
79+
ctest --output-on-failure --timeout 300 -j$(nproc) --verbose
10780
10881
- name: Test Summary
10982
if: always()

include/neo/smartcontract/transaction_verifier.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ namespace neo::smartcontract
151151
* @param gasConsumed The gas consumed.
152152
* @param engine The application engine.
153153
*/
154-
VerificationOutput(VerificationResult result, const std::string& errorMessage = "", int64_t gasConsumed = 0, std::unique_ptr<ApplicationEngine> engine = nullptr)
155-
: result(result), errorMessage(errorMessage), gasConsumed(gasConsumed), engine(std::move(engine))
154+
VerificationOutput(VerificationResult result_, const std::string& errorMessage_ = "", int64_t gasConsumed_ = 0, std::unique_ptr<ApplicationEngine> engine_ = nullptr)
155+
: result(result_), errorMessage(errorMessage_), gasConsumed(gasConsumed_), engine(std::move(engine_))
156156
{
157157
}
158158
};

tests/unit/console_service/test_console_service_base.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ namespace neo::console_service::tests
8585

8686
TEST_F(ConsoleServiceBaseTest, TestHelpCommand)
8787
{
88-
service->OnHelpCommand();
88+
// Use OnCommand to test help functionality
89+
service->OnCommand("help");
8990
std::string output = GetOutput();
9091

9192
EXPECT_TRUE(output.find("Base Commands:") != std::string::npos);
@@ -97,7 +98,7 @@ namespace neo::console_service::tests
9798

9899
TEST_F(ConsoleServiceBaseTest, TestHelpSpecificCommand)
99100
{
100-
service->OnHelpCommand("help");
101+
service->OnCommand("help help");
101102
std::string output = GetOutput();
102103

103104
EXPECT_TRUE(output.find("Shows help information") != std::string::npos);
@@ -106,7 +107,7 @@ namespace neo::console_service::tests
106107

107108
TEST_F(ConsoleServiceBaseTest, TestHelpUnknownCommand)
108109
{
109-
service->OnHelpCommand("unknown");
110+
service->OnCommand("help unknown");
110111
std::string output = GetOutput();
111112

112113
EXPECT_TRUE(output.find("Command not found") != std::string::npos);
@@ -115,12 +116,12 @@ namespace neo::console_service::tests
115116
TEST_F(ConsoleServiceBaseTest, TestClearCommand)
116117
{
117118
// Test that clear command doesn't crash
118-
EXPECT_NO_THROW(service->OnClear());
119+
EXPECT_NO_THROW(service->OnCommand("clear"));
119120
}
120121

121122
TEST_F(ConsoleServiceBaseTest, TestVersionCommand)
122123
{
123-
service->OnVersion();
124+
service->OnCommand("version");
124125
std::string output = GetOutput();
125126

126127
EXPECT_TRUE(output.find("Neo C++ Node") != std::string::npos);

0 commit comments

Comments
 (0)