Add test fixture.
This commit is contained in:
parent
af6fad72eb
commit
d6d4319e21
37 changed files with 421 additions and 279 deletions
|
@ -3,8 +3,7 @@
|
|||
#include "AudioWriter.h"
|
||||
#include "WasapiInterface.h"
|
||||
|
||||
#include "TestCase.h"
|
||||
#include "TestCaseRunner.h"
|
||||
#include "TestFramework.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -13,50 +12,23 @@
|
|||
#endif
|
||||
#include <iostream>
|
||||
|
||||
class TestWriteWav : public TestCase
|
||||
TEST_CASE(TestWriteWav, "audio")
|
||||
{
|
||||
public:
|
||||
bool Run() override
|
||||
{
|
||||
AudioWriter writer;
|
||||
writer.SetPath("test.wav");
|
||||
AudioWriter writer;
|
||||
writer.SetPath("test.wav");
|
||||
|
||||
AudioSynth synth;
|
||||
auto sample = synth.GetSineWave(240, 5);
|
||||
AudioSynth synth;
|
||||
auto sample = synth.GetSineWave(240, 5);
|
||||
|
||||
writer.Write(sample);
|
||||
return true;
|
||||
}
|
||||
writer.Write(sample);
|
||||
};
|
||||
|
||||
class TestAudioRender : public TestCase
|
||||
TEST_CASE(TestAudioRender, "audio")
|
||||
{
|
||||
public:
|
||||
bool Run() override
|
||||
{
|
||||
|
||||
#ifdef _WIN32
|
||||
WasapiInterface audio_interface;
|
||||
auto device = AudioDevice::Create();
|
||||
audio_interface.Play(device);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
//int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
|
||||
int main()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
|
||||
#endif
|
||||
std::cout << "into entry point" << std::endl;
|
||||
TestCaseRunner runner;
|
||||
runner.AddTestCase("TestWriteNav", std::make_unique<TestWriteWav>());
|
||||
runner.AddTestCase("TestAudioRender", std::make_unique<TestAudioRender>());
|
||||
|
||||
const auto testsPassed = runner.Run();
|
||||
return testsPassed ? 0 : -1;
|
||||
#ifdef _WIN32
|
||||
CoUninitialize();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,31 +1,16 @@
|
|||
#include "MidiReader.h"
|
||||
|
||||
#include "TestCase.h"
|
||||
#include "TestCaseRunner.h"
|
||||
#include "TestFramework.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
class TestReadMidi : public TestCase
|
||||
TEST_CASE(TestReadMidi, "audio")
|
||||
{
|
||||
public:
|
||||
bool Run() override
|
||||
{
|
||||
MidiReader reader;
|
||||
reader.Read("/home/jmsgrogan/Downloads/test.mid");
|
||||
MidiReader reader;
|
||||
reader.Read("/home/jmsgrogan/Downloads/test.mid");
|
||||
|
||||
auto document = reader.GetDocument();
|
||||
std::cout << document->Serialize() << std::endl;
|
||||
return true;
|
||||
}
|
||||
auto document = reader.GetDocument();
|
||||
// std::cout << document->Serialize() << std::endl;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
TestCaseRunner runner;
|
||||
runner.AddTestCase("TestReadMidi", std::make_unique<TestReadMidi>());
|
||||
|
||||
const auto testsPassed = runner.Run();
|
||||
return testsPassed ? 0 : -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue