diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2016-03-13 09:49:33 +0300 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2016-09-02 21:21:28 +0300 |
commit | cfaa2cd39b7256a868a4f5cd83aac207df6bd1b3 (patch) | |
tree | 75efff26584e046566d17cd308d45b6b0fd5abfc /src/util_ut.cpp | |
parent | b4df8a7c2dd12eea27c8cc52bd52a1bb8c00943f (diff) | |
download | atracdenc-cfaa2cd39b7256a868a4f5cd83aac207df6bd1b3.tar.gz |
Dirty implementation of atrac3 encoder:
- no JS mode
- constant quantiser for tonal components
- gain controll implemented but produces some artifacts with real signals.
- etc...
Diffstat (limited to 'src/util_ut.cpp')
-rw-r--r-- | src/util_ut.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/util_ut.cpp b/src/util_ut.cpp new file mode 100644 index 0000000..ccd9fce --- /dev/null +++ b/src/util_ut.cpp @@ -0,0 +1,26 @@ +#include "util.h" +#include <gtest/gtest.h> + +#include <vector> + + +TEST(Util, SwapArrayTest) { + + TFloat arr[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; + SwapArray(arr, 8); + for (size_t i = 0; i < 8; ++i) { + EXPECT_NEAR((TFloat)i, arr[7-i], 0.000000000001); + } +} + +TEST(Util, GetFirstSetBitTest) { + EXPECT_EQ(1, GetFirstSetBit(2)); + EXPECT_EQ(1, GetFirstSetBit(3)); + EXPECT_EQ(2, GetFirstSetBit(4)); + EXPECT_EQ(2, GetFirstSetBit(5)); + EXPECT_EQ(2, GetFirstSetBit(6)); + EXPECT_EQ(2, GetFirstSetBit(7)); + EXPECT_EQ(3, GetFirstSetBit(8)); + EXPECT_EQ(3, GetFirstSetBit(9)); + EXPECT_EQ(3, GetFirstSetBit(10)); +} |