#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/audio/vector_math.h"
#include <cmath>
#include <limits>
#include <numeric>
#include <random>
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink::vector_math {
namespace {
struct MemoryLayout { … };
constexpr size_t kMaxBitAlignment = …;
constexpr size_t kMaxByteAlignment = …;
constexpr size_t kMaxStride = …;
constexpr MemoryLayout kMemoryLayouts[] = …;
constexpr size_t kMemoryLayoutCount = …;
constexpr size_t kMaxVectorSizeInBytes = …;
constexpr size_t kVectorSizesInBytes[] = …;
constexpr size_t kVectorSizeCount = …;
bool Equal(float a, float b) { … }
template <typename T>
class TestVector { … };
template <typename T>
Vector<TestVector<const T>> GetPrimaryVectors(const T* base) { … }
template <typename T>
Vector<TestVector<T>> GetSecondaryVectors(
T* base,
const MemoryLayout* primary_memory_layout,
size_t size) { … }
template <typename T>
Vector<TestVector<T>> GetSecondaryVectors(
T* base,
const TestVector<const float>& primary_vector) { … }
class VectorMathTest : public testing::Test { … };
float VectorMathTest::destinations_[kDestinationCount][kFloatArraySize];
float VectorMathTest::sources_[kSourceCount][kFloatArraySize];
TEST_F(VectorMathTest, Conv) { … }
TEST_F(VectorMathTest, Vadd) { … }
TEST_F(VectorMathTest, Vsub) { … }
TEST_F(VectorMathTest, Vclip) { … }
TEST_F(VectorMathTest, Vmaxmgv) { … }
TEST_F(VectorMathTest, Vmul) { … }
TEST_F(VectorMathTest, Vsma) { … }
TEST_F(VectorMathTest, Vsmul) { … }
TEST_F(VectorMathTest, Vsadd) { … }
TEST_F(VectorMathTest, Vsvesq) { … }
TEST_F(VectorMathTest, Zvmul) { … }
}
}