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>
66 lines
2.4 KiB
C++
66 lines
2.4 KiB
C++
/*
|
|
* 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;
|
|
}
|