Files
obs-streamer-tools-plugin/core/tests/test_util.h
shadowdaoandClaude Sonnet 5 969b8db94a
Build / macOS (macos-latest) (push) Successful in 33s
Build / Linux (ubuntu-24.04) (push) Successful in 54s
Build / Windows (windows-latest) (push) Successful in 12m10s
license: relicense first-party code from GPL-2.0-or-later to Apache-2.0
Owner sign-off: replace root LICENSE with Apache License 2.0, add a root
NOTICE file, and swap the GPL-2.0 boilerplate header in every first-party
core/ and obs-adapter/ source file for a short Apache-2.0 notice.

This resolves review finding C2 (GPLv2 top-level LICENSE vs. the vendored
Apache-2.0 LiveKit SDK is a license-compatibility violation): the whole
repo is now Apache-2.0, matching LiveKit, so there's no GPL/Apache clash
left. Updated the README Status gate and the CI workflow comment to reflect
that C2 is resolved, while leaving the C1 WebRTC/OpenH264 patent/royalty
gate untouched -- that question is still open and still blocks release.

third_party/ stays under its own upstream licenses; only this project's own
code changed hands. All 6 CTest suites still pass after the header swap.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RL8abRmgFXkVASHkkqiJbE
2026-09-07 04:44:16 -07:00

85 lines
3.2 KiB
C++

/*
streamer-tools OBS Camera Plugin - minimal test harness
Copyright (C) 2026 CyberCoveLLC <jknapp85@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
*/
#pragma once
// Deliberately dependency-free (no gtest/catch2) so the core library's test
// targets add no package-manager or network step to any of the three CI
// platforms. Unlike bare assert(), this keeps running after a failure and
// prints a real pass/fail count, so CI output says how much actually ran.
#include <cstdio>
#include <string>
namespace st_test_detail {
inline int &checks_run()
{
static int n = 0;
return n;
}
inline int &checks_failed()
{
static int n = 0;
return n;
}
inline std::string to_display(const std::string &v)
{
return "\"" + v + "\"";
}
inline std::string to_display(const char *v)
{
return v ? ("\"" + std::string(v) + "\"") : std::string("(null)");
}
inline std::string to_display(bool v)
{
return v ? "true" : "false";
}
template<typename T> inline std::string to_display(const T &v)
{
return std::to_string(v);
}
} // namespace st_test_detail
#define ST_ASSERT(expr) \
do { \
++st_test_detail::checks_run(); \
if (!(expr)) { \
++st_test_detail::checks_failed(); \
std::fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #expr); \
} \
} while (0)
#define ST_ASSERT_EQ(actual, expected) \
do { \
++st_test_detail::checks_run(); \
auto _st_a = (actual); \
auto _st_e = (expected); \
if (!(_st_a == _st_e)) { \
++st_test_detail::checks_failed(); \
std::fprintf(stderr, "FAIL %s:%d: %s\n actual: %s\n expected: %s\n", \
__FILE__, __LINE__, #actual " == " #expected, \
st_test_detail::to_display(_st_a).c_str(), \
st_test_detail::to_display(_st_e).c_str()); \
} \
} while (0)
inline int st_test_report(const char *suite)
{
const int run = st_test_detail::checks_run();
const int failed = st_test_detail::checks_failed();
if (failed == 0) {
std::printf("%s: %d checks passed\n", suite, run);
return 0;
}
std::printf("%s: %d/%d checks FAILED\n", suite, failed, run);
return 1;
}