scaffold: M0 skeleton + agent onboarding (build, architecture, progress)
Turn the design into a buildable, dependency-free M0 skeleton plus the
onboarding layer so a new agent can pick up instantly.
Build system:
- CMake + CMakePresets (dev = no deps; server-release = vcpkg) + vcpkg.json
- Skeleton builds with just a C++20 compiler; deps stay off until needed
- .gitattributes (LF), .gitignore, .clang-format
Core (libvoicecat):
- core/include/voicecat.h: full C ABI (the client/server contract), stubbed
- core/proto/voicecat.proto: control-plane wire format, matches docs/protocol.md
- src/{net,crypto,codec,protocol,session,audio,core}: subsystem stubs that
return VC_ERR_NOT_IMPLEMENTED, each pointing to its design doc
- server/ (voicecat-server) and tools/vccli/ link the core
- tests/: CTest smoke test asserting the C ABI contract (behavior, not just build)
- clients/{apple,windows}: M4 placeholders
Onboarding for agents:
- CLAUDE.md: hub — build/test commands, architecture at a glance, doc map, rules
- AGENTS.md: working method (behavior-driven; clean compile is the floor not the goal)
- PROGRESS.md: living tracker — M0 done, M1 task checklist, "where we left off"
Verified: cmake --preset dev && cmake --build --preset dev && ctest --preset dev → green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
8
tests/CMakeLists.txt
Normal file
8
tests/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
# Tests use plain asserts + exit codes for now (no framework dependency in the skeleton).
|
||||
# A real framework (e.g. Catch2/GoogleTest via vcpkg) can be added when VOICECAT_USE_VCPKG_DEPS
|
||||
# is on. Behavior tests — not just "it compiles" — are how milestones are judged (AGENTS.md).
|
||||
|
||||
add_executable(test_smoke test_smoke.cpp)
|
||||
target_link_libraries(test_smoke PRIVATE voicecat::voicecat)
|
||||
target_compile_features(test_smoke PRIVATE cxx_std_20)
|
||||
add_test(NAME smoke COMMAND test_smoke)
|
||||
65
tests/test_smoke.cpp
Normal file
65
tests/test_smoke.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* test_smoke — verifies the core links and the C ABI behaves as specified for M0.
|
||||
*
|
||||
* This is intentionally a behavior test, not a "does it compile" check: it asserts the
|
||||
* documented contract (version present, handle lifecycle, invalid-arg guards, and that
|
||||
* unimplemented calls report VC_ERR_NOT_IMPLEMENTED rather than crashing).
|
||||
*/
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include "voicecat.h"
|
||||
|
||||
static int g_failures = 0;
|
||||
|
||||
#define CHECK(cond) \
|
||||
do { \
|
||||
if (!(cond)) { \
|
||||
std::printf("FAIL: %s (%s:%d)\n", #cond, __FILE__, __LINE__); \
|
||||
++g_failures; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
int main() {
|
||||
// Version + result strings are always available.
|
||||
CHECK(vc_version_string() != nullptr);
|
||||
CHECK(std::strlen(vc_version_string()) > 0);
|
||||
CHECK(std::strcmp(vc_result_string(VC_OK), "ok") == 0);
|
||||
CHECK(std::strcmp(vc_result_string(VC_ERR_NOT_IMPLEMENTED), "not implemented") == 0);
|
||||
|
||||
// Null-config create is rejected; valid create yields a handle.
|
||||
vc_callbacks cb{};
|
||||
CHECK(vc_client_create(nullptr, cb) == nullptr);
|
||||
|
||||
vc_config cfg{};
|
||||
cfg.client_name = "test";
|
||||
cfg.client_version = "0";
|
||||
cfg.log_level = VC_LOG_OFF;
|
||||
vc_client* c = vc_client_create(&cfg, cb);
|
||||
CHECK(c != nullptr);
|
||||
|
||||
// Invalid-arg guards on the ABI.
|
||||
CHECK(vc_connect(nullptr, "h", 1) == VC_ERR_INVALID_ARG);
|
||||
CHECK(vc_connect(c, nullptr, 1) == VC_ERR_INVALID_ARG);
|
||||
CHECK(vc_send_text(c, VC_TEXT_CHANNEL, 0, nullptr) == VC_ERR_INVALID_ARG);
|
||||
|
||||
// Unimplemented subsystems report NOT_IMPLEMENTED (not a crash) in the M0 skeleton.
|
||||
CHECK(vc_connect(c, "127.0.0.1", 8384) == VC_ERR_NOT_IMPLEMENTED);
|
||||
CHECK(vc_authenticate_guest(c, "nick") == VC_ERR_NOT_IMPLEMENTED);
|
||||
CHECK(vc_join_channel(c, 1, nullptr) == VC_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
vc_device_list dl;
|
||||
CHECK(vc_list_devices(c, VC_DEVICE_INPUT, &dl) == VC_ERR_NOT_IMPLEMENTED);
|
||||
CHECK(dl.count == 0);
|
||||
vc_free_device_list(&dl);
|
||||
|
||||
vc_client_destroy(c);
|
||||
vc_client_destroy(nullptr); // must be safe
|
||||
|
||||
if (g_failures == 0) {
|
||||
std::printf("smoke: all checks passed\n");
|
||||
return 0;
|
||||
}
|
||||
std::printf("smoke: %d failure(s)\n", g_failures);
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user