File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed
Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -25,3 +25,17 @@ target_link_libraries(
2525)
2626
2727gtest_discover_tests(costume_test)
28+
29+ # sound_test
30+ add_executable (
31+ sound_test
32+ sound_test.cpp
33+ )
34+
35+ target_link_libraries (
36+ sound_test
37+ GTest::gtest_main
38+ scratchcpp
39+ )
40+
41+ gtest_discover_tests(sound_test)
Original file line number Diff line number Diff line change 1+ #include < scratchcpp/sound.h>
2+
3+ #include " ../common.h"
4+
5+ using namespace libscratchcpp ;
6+
7+ TEST (SoundTest, Constructors)
8+ {
9+ Sound sound (" sound1" , " a" , " svg" );
10+ ASSERT_EQ (sound.assetId (), " a" );
11+ ASSERT_EQ (sound.name (), " sound1" );
12+ ASSERT_EQ (sound.dataFormat (), " svg" );
13+ ASSERT_EQ (sound.md5ext (), " a.svg" );
14+ ASSERT_EQ (sound.rate (), 0 );
15+ ASSERT_EQ (sound.sampleCount (), 0 );
16+ }
17+
18+ TEST (SoundTest, Rate)
19+ {
20+ Sound sound (" sound1" , " a" , " svg" );
21+
22+ sound.setRate (2 );
23+ ASSERT_EQ (sound.rate (), 2 );
24+ }
25+
26+ TEST (SoundTest, SampleCount)
27+ {
28+ Sound sound (" sound1" , " a" , " svg" );
29+
30+ sound.setSampleCount (10 );
31+ ASSERT_EQ (sound.sampleCount (), 10 );
32+ }
You can’t perform that action at this time.
0 commit comments