MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / main

Function main

crates/bindings-cpp/tests/unit/main.cpp:6–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include <iostream>
5
6int main(int argc, char** argv) {
7 bool verbose = argc > 1 && std::string(argv[1]) == "-v";
8 int failures = 0;
9
10 for (const auto& test : SpacetimeDB::UnitTests::all_tests()) {
11 try {
12 test.func();
13 if (verbose) {
14 std::cout << "[PASS] " << test.name << '\n';
15 }
16 } catch (const std::exception& ex) {
17 ++failures;
18 std::cerr << "[FAIL] " << test.name << ": " << ex.what() << '\n';
19 } catch (...) {
20 ++failures;
21 std::cerr << "[FAIL] " << test.name << ": unknown exception\n";
22 }
23 }
24
25 if (!verbose) {
26 if (failures == 0) {
27 std::cout << "Passed " << SpacetimeDB::UnitTests::all_tests().size() << " unit tests\n";
28 } else {
29 std::cerr << failures << " unit test(s) failed\n";
30 }
31 }
32
33 return failures == 0 ? 0 : 1;
34}

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…