Files
obs-streamer-tools-plugin/core/tests/test_core.cpp
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

57 lines
2.2 KiB
C++

/*
streamer-tools OBS Camera Plugin - core library tests
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
*/
// NOTE on why this file uses ST_ASSERT and not assert(): CI builds Release,
// which defines NDEBUG, which compiles every bare assert() out entirely. This
// suite previously passed unconditionally for exactly that reason. The
// ST_ASSERT macros in test_util.h are always live and report a pass/fail
// count.
#include <cstring>
#include <string>
#include "stplugin/core.h"
#include "stplugin/core_c.h"
#include "test_util.h"
int main()
{
// The version string comes through both the C++ API and the C ABI
// wrapper, and the two must agree.
const char *cpp_version = stplugin::core_version();
ST_ASSERT(cpp_version != nullptr);
ST_ASSERT(cpp_version != nullptr && std::strlen(cpp_version) > 0);
const char *c_version = stplugin_core_version();
ST_ASSERT(c_version != nullptr);
ST_ASSERT_EQ(std::string(cpp_version ? cpp_version : ""), std::string(c_version ? c_version : ""));
// It is the version CMake injected, not a hand-maintained literal.
ST_ASSERT_EQ(std::string(cpp_version ? cpp_version : ""), std::string(STPLUGIN_EXPECTED_CORE_VERSION));
// ConnectionConfig::is_valid(): all three fields are required. Named
// locals rather than braced temporaries inline, because the commas inside
// a braced initialiser would be read as macro argument separators.
const stplugin::ConnectionConfig complete{"https://streamers.example.com", "main-room", "readkey123"};
const stplugin::ConnectionConfig no_url{"", "main-room", "readkey123"};
const stplugin::ConnectionConfig no_slug{"https://streamers.example.com", "", "readkey123"};
const stplugin::ConnectionConfig no_key{"https://streamers.example.com", "main-room", ""};
const stplugin::ConnectionConfig empty;
ST_ASSERT(complete.is_valid());
ST_ASSERT(!no_url.is_valid());
ST_ASSERT(!no_slug.is_valid());
ST_ASSERT(!no_key.is_valid());
ST_ASSERT(!empty.is_valid());
return st_test_report("core");
}