Files
moloapp/tests/example/support/Assert.hpp
T
retoorandClaude Sonnet 5.5 837de58136 feat(clients): google cloud voice: generic client, TTS, STT, Gemini audio, live voice page
src/google: GoogleClient over molo::clients (key in x-goog-api-key, never in
URLs), Service base, TextToSpeech, SpeechToText, Generative (replies, audio
in, audio out), Recognizer/Synthesizer seams with cloud, gemini and vertex
backends, VoicePipeline with bounded history. Example: /voice live
conversation page, /voice/{say,hear,turn,reset}, /google/status. Keys load
from env, .env.json.local, .env.json. Paid routes are excluded from locust.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 04:05:41 +02:00

63 lines
1.8 KiB
C++

#pragma once
// Shared test support for the living example suite. Not a test itself: every
// test file owns one main() and uses these helpers for loud assertions.
#include <iostream>
#include <optional>
#include <string>
#include "app/App.hpp"
#include "google/client.h"
#include "fw/TestClient.hpp"
namespace molo::example::test {
inline int g_failures = 0;
inline void check(bool cond, const std::string& what) {
if (cond) {
std::cout << " ok: " << what << "\n";
} else {
++g_failures;
std::cout << " FAIL: " << what << "\n";
}
}
inline bool contains(const std::string& hay, const std::string& needle) {
return hay.find(needle) != std::string::npos;
}
inline int finish(const std::string& name) {
if (g_failures == 0) {
std::cout << "PASS: " << name << "\n";
return 0;
}
std::cout << "FAIL: " << name << " (" << g_failures << " failures)\n";
return 1;
}
struct Fixture {
molo::example::app::Services services;
std::shared_ptr<molo::example::fw::Application> app;
std::shared_ptr<molo::example::fw::TestClient> client;
Fixture() : Fixture(nullptr) {}
// A scripted Google client can be injected (see support/GoogleRig.hpp).
// Null builds the client from the environment like production. Scripted
// clients default to the classic cloud wire paths; pass a backend to test
// the Gemini ones.
explicit Fixture(std::shared_ptr<molo::google::GoogleClient> google,
std::optional<molo::google::VoiceBackend> backend =
std::nullopt) {
if (google && !backend) backend = molo::google::VoiceBackend::kCloud;
services.voice_backend = backend;
services.google = std::move(google);
app = molo::example::app::build_application(services);
client = std::make_shared<molo::example::fw::TestClient>(app);
}
};
} // namespace molo::example::test