23 lines
699 B
C++
23 lines
699 B
C++
#include "gtest/gtest.h"
|
|
#include "FSKModulator.h"
|
|
#include <vector>
|
|
|
|
TEST(FSKModulatorTest, SignalLength) {
|
|
using namespace milstd;
|
|
|
|
// Parameters
|
|
FSKModulator modulator(FSKModulator::ShiftType::NarrowShift, 75.0, 8000.0);
|
|
|
|
// Input data bits
|
|
std::vector<uint8_t> dataBits = {1, 0, 1, 1, 0};
|
|
|
|
// Modulate the data
|
|
std::vector<double> signal = modulator.modulate(dataBits);
|
|
|
|
// Calculate expected number of samples
|
|
size_t samplesPerSymbol = static_cast<size_t>(modulator.getSampleRate() * modulator.getSymbolDuration());
|
|
size_t expectedSamples = dataBits.size() * samplesPerSymbol;
|
|
|
|
// Verify signal length
|
|
EXPECT_EQ(signal.size(), expectedSamples);
|
|
} |