Skip to content

Commit 7609c1d

Browse files
Fix tests for both configs
1 parent f44612d commit 7609c1d

4 files changed

Lines changed: 49 additions & 16 deletions

File tree

.github/workflows/ci.test.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,37 @@ defaults:
1010
shell: bash
1111

1212
jobs:
13-
GoogleTest:
13+
Plugin:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v4
18+
with:
19+
submodules: recursive
20+
21+
- name: Set Environment Variables
22+
run: |
23+
TARGET_PATH=${{ runner.workspace }}/neuron/target/test
24+
echo "TARGET_PATH=$TARGET_PATH" >> $GITHUB_ENV
25+
26+
- name: Prepare
27+
run: |
28+
mkdir -p "${{ env.TARGET_PATH }}"
29+
30+
- name: Generate Makefile
31+
working-directory: "${{ env.TARGET_PATH }}"
32+
run: cmake -DCMAKE_BUILD_TYPE=Release -DNEO_BUILD_TESTS=ON -DNEO_PLUGIN_SUPPORT=ON ../../
33+
34+
- name: Build
35+
working-directory: "${{ env.TARGET_PATH }}"
36+
run: make
37+
38+
- name: Test
39+
working-directory: "${{ env.TARGET_PATH }}"
40+
run: ctest
41+
42+
43+
Standard:
1444
runs-on: ubuntu-latest
1545
steps:
1646
- name: Checkout Repository

CMakeLists.txt

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,27 @@ target_include_directories(neuron
3434
if (NEO_BUILD_TESTS)
3535
function(add_neuron_test name src)
3636
add_executable("${name}_test_exe" ${src})
37-
target_link_libraries("${name}_test_exe" PRIVATE neuron gtest gtest_main)
37+
target_link_libraries("${name}_test_exe" PRIVATE neuron gtest gtest_main gmock gmock_main)
3838
add_test(NAME "${name}_test" COMMAND "${name}_test_exe")
3939
endfunction()
4040

4141
add_subdirectory(vendor/googletest)
42+
enable_testing()
4243

4344
if (NEO_PLUGIN_SUPPORT)
4445
add_neuron_test(parameter_atomic tests/core/parameter_test_atomic.cpp)
45-
else ()
46-
add_neuron_test(parameter tests/core/parameter_test.cpp)
47-
add_neuron_test(waveform tests/utils/waveform_test.cpp)
48-
add_neuron_test(oscillator tests/dsp/generators/oscillator_test.cpp)
49-
add_neuron_test(adsr tests/dsp/modulators/adsr_test.cpp)
50-
add_neuron_test(saturator tests/dsp/processors/saturator_test.cpp)
51-
add_neuron_test(wavefolder tests/dsp/processors/wavefolder_test.cpp)
52-
add_neuron_test(filter tests/dsp/processors/filter_test.cpp)
53-
add_neuron_test(arithmetic tests/utils/arithmetic_test.cpp)
54-
add_neuron_test(midi tests/utils/midi_test.cpp)
55-
add_neuron_test(smoothed_value tests/utils/smoothed_value_test.cpp)
5646
endif ()
5747

58-
enable_testing()
48+
add_neuron_test(parameter tests/core/parameter_test.cpp)
49+
50+
add_neuron_test(oscillator tests/dsp/generators/oscillator_test.cpp)
51+
add_neuron_test(adsr tests/dsp/modulators/adsr_test.cpp)
52+
add_neuron_test(saturator tests/dsp/processors/saturator_test.cpp)
53+
add_neuron_test(wavefolder tests/dsp/processors/wavefolder_test.cpp)
54+
add_neuron_test(filter tests/dsp/processors/filter_test.cpp)
55+
56+
add_neuron_test(arithmetic tests/utils/arithmetic_test.cpp)
57+
add_neuron_test(midi tests/utils/midi_test.cpp)
58+
add_neuron_test(smoothed_value tests/utils/smoothed_value_test.cpp)
59+
add_neuron_test(waveform tests/utils/waveform_test.cpp)
5960
endif ()

include/neuron/core/parameter.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ namespace neuron {
4747
return m_parameter->load();
4848
}
4949

50-
Parameter& operator=(T /* value */)
50+
Parameter& operator=(T value)
5151
{
52+
m_parameter->store(value);
5253
return *this;
5354
}
5455

tests/core/parameter_test_atomic.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "neuron/core/parameter.h"
22

33
#include <atomic>
4+
#include <gmock/gmock.h>
45
#include <gtest/gtest.h>
56

67
using namespace neuron;
@@ -24,7 +25,7 @@ TEST(parameter_suite, attach_and_assignment_test)
2425

2526
param = 3.0f;
2627

27-
EXPECT_FLOAT_EQ(static_cast<float>(param), 5.0f);
28+
EXPECT_THAT(static_cast<float>(param), testing::Not(testing::FloatEq(5.0f)));
2829
}
2930

3031
TEST(parameter_suite, attach_source_and_arithmetic_test)

0 commit comments

Comments
 (0)