Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ coverage_report="$("$LLVM_COV" report \
--instr-profile="$PROFDATA_FILE" \
--ignore-filename-regex="$IGNORE_FILENAME_REGEX")"

echo "$coverage_report"
echo "$coverage_report" | tee "$BUILD_DIR/llvm-cov-report.txt"

if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <audioapi/core/OfflineAudioContext.h>
#include <audioapi/core/analysis/AnalyserNode.h>
#include <audioapi/types/NodeOptions.h>
#include <gtest/gtest.h>
#include <test/src/MockAudioEventHandlerRegistry.h>

#include <memory>

namespace audioapi::test {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add here (and in other tests) some kind of codetag to signalise that this should/will be changed in the future. Like TODO/FIXME notation or equivalent.

TEST(AnalyserNodeTest, TrivialConstruct) {
auto registry = std::make_shared<MockAudioEventHandlerRegistry>();
constexpr size_t LENGTH = 128;
constexpr float SAMPLE_RATE = 44100.0f;
auto context = std::make_shared<OfflineAudioContext>(2, LENGTH, SAMPLE_RATE, registry);
AnalyserNode analyser(context, AnalyserOptions{});
EXPECT_EQ(analyser.getFFTSize(), AnalyserOptions::kDefaultFftSize);
}

} // namespace audioapi::test
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <audioapi/core/OfflineAudioContext.h>
#include <audioapi/core/sources/RecorderAdapterNode.h>
#include <gtest/gtest.h>
#include <test/src/MockAudioEventHandlerRegistry.h>

#include <memory>

namespace audioapi::test {

TEST(RecorderAdapterNodeTest, TrivialConstructAndInit) {
auto registry = std::make_shared<MockAudioEventHandlerRegistry>();
auto context = std::make_shared<OfflineAudioContext>(2, 128, 44100.0f, registry);
RecorderAdapterNode adapter(context);
adapter.init(256, 1, 44100.0f);
adapter.adapterCleanup();
}

} // namespace audioapi::test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <audioapi/core/utils/RotatingFileWriter.h>
#include <gtest/gtest.h>

#include <string>

namespace audioapi::test {

TEST(RotatingFileWriterTest, TrivialConstruct) {
RotatingFileWriter writer(1024, [](const auto &) { return nullptr; }, [](const std::string &) {});
SUCCEED();
}

} // namespace audioapi::test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <audioapi/core/types/ParamEventType.h>
#include <audioapi/core/utils/param/ParamControlQueue.h>
#include <audioapi/core/utils/param/ParamEvent.h>
#include <gtest/gtest.h>

namespace audioapi::test {

TEST(ParamControlQueueTest, TrivialConstructAndPurge) {
ParamControlQueue queue;
ParamEvent event(ParamEventType::SET_VALUE, 0.0);
EXPECT_TRUE(queue.checkCurveExclusion(event).is_ok());
queue.purge(0.0);
}

} // namespace audioapi::test
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <audioapi/core/utils/Disposer.hpp>
#include <audioapi/core/utils/graph/Graph.h>
#include <gtest/gtest.h>
#include <test/src/graph/TestGraphUtils.h>

#include <memory>

namespace audioapi::test {

TEST(HostNodeTest, TrivialConstruct) {
utils::DisposerImpl<audioapi::DISPOSER_PAYLOAD_SIZE> disposer{64};
auto graph = std::make_shared<utils::graph::Graph>(64, &disposer);
utils::graph::MockHostNode node(graph);
EXPECT_NE(node.rawNode(), nullptr);
}

} // namespace audioapi::test
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <audioapi/utils/CircularOverflowableAudioArray.h>
#include <gtest/gtest.h>

#include <array>

namespace audioapi::test {

TEST(CircularOverflowableAudioArrayTest, WriteThenReadRoundTrips) {
constexpr size_t kCapacity = 8;
constexpr size_t kFrames = 4;

CircularOverflowableAudioArray buffer(kCapacity);
const std::array<float, kFrames> input = {1.0f, 2.0f, 3.0f, 4.0f};

buffer.write(input.data(), kFrames);

std::array<float, kFrames> output = {};
EXPECT_EQ(buffer.read(output.data(), kFrames), kFrames);
EXPECT_EQ(output, input);
}

} // namespace audioapi::test
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <audioapi/utils/ThreadPool.hpp>
#include <gtest/gtest.h>

#include <atomic>

namespace audioapi::test {

TEST(ThreadPoolTest, ScheduleRunsTaskAndWaitReturns) {
std::atomic<int> counter{0};
ThreadPool<thread_pool::kSmallTaskStorageBytes> pool(2, 8, 8);

pool.schedule([&counter]() { counter.fetch_add(1, std::memory_order_relaxed); });
pool.wait();

EXPECT_EQ(counter.load(std::memory_order_relaxed), 1);
}

} // namespace audioapi::test
Loading