Starting to add tests
This commit is contained in:
parent
16143afe0d
commit
03e512dc12
35
meson.build
35
meson.build
|
@ -40,12 +40,11 @@ quickerNESCoreSrc = [
|
||||||
|
|
||||||
# quickerNES Core Configuration
|
# quickerNES Core Configuration
|
||||||
|
|
||||||
quickerNESCoreCPPFlags = [ '-Wfatal-errors','-Wall' ]
|
quickerNESCoreDependency = declare_dependency(
|
||||||
quickerNESCoreIncludeDirs = include_directories(['source/core', 'extern'])
|
compile_args : [ '-Wfatal-errors','-Wall' ],
|
||||||
quickerNESCoreDependencies = [ ]
|
include_directories : include_directories(['source', 'source/core', 'extern']),
|
||||||
quickerNESCoreCPPFlags = [ ]
|
sources : quickerNESCoreSrc,
|
||||||
quickerNESCoreCFlags = [ ]
|
)
|
||||||
quickerNESCoreLinkArgs = [ ]
|
|
||||||
|
|
||||||
# Building playback/validation tool
|
# Building playback/validation tool
|
||||||
|
|
||||||
|
@ -57,18 +56,20 @@ quickerNESPlayerSrc = [
|
||||||
'extern/hqn/options.cpp'
|
'extern/hqn/options.cpp'
|
||||||
]
|
]
|
||||||
|
|
||||||
quickerNESPlayerIncludeDirs = include_directories([ 'source'])
|
quickerNESPlayerDependency = declare_dependency(
|
||||||
quickerNESPlayerDependencies = [ dependency('sdl2'), dependency('SDL2_image') ]
|
compile_args : [ '-DNCURSES' ],
|
||||||
quickerNESPlayerCPPFlags = [ '-DNCURSES' ]
|
dependencies : [ quickerNESCoreDependency, dependency('sdl2'), dependency('SDL2_image') ],
|
||||||
quickerNESPlayerCFlags = [ ]
|
include_directories : include_directories(['source']),
|
||||||
quickerNESPlayerLinkArgs = [ '-lncurses' ]
|
link_args : [ '-lncurses' ],
|
||||||
|
sources : quickerNESPlayerSrc
|
||||||
|
)
|
||||||
|
|
||||||
executable('player',
|
executable('player',
|
||||||
'source/player.cpp',
|
'source/player.cpp',
|
||||||
sources: [ quickerNESCoreSrc, quickerNESPlayerSrc ],
|
dependencies: quickerNESPlayerDependency,
|
||||||
include_directories: [ quickerNESCoreIncludeDirs, quickerNESPlayerIncludeDirs ],
|
|
||||||
dependencies: [ quickerNESCoreDependencies, quickerNESPlayerDependencies ],
|
|
||||||
cpp_args: [ quickerNESCoreCPPFlags, quickerNESPlayerCPPFlags ],
|
|
||||||
c_args: [ quickerNESCoreCFlags, quickerNESPlayerCFlags ],
|
|
||||||
link_args: [ quickerNESCoreLinkArgs, quickerNESPlayerLinkArgs ]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Building tests
|
||||||
|
if get_option('buildTests') == true
|
||||||
|
subdir('tests')
|
||||||
|
endif
|
|
@ -0,0 +1,6 @@
|
||||||
|
option('buildTests',
|
||||||
|
type : 'boolean',
|
||||||
|
value : false,
|
||||||
|
description : 'Build test suite',
|
||||||
|
yield: true
|
||||||
|
)
|
|
@ -26,7 +26,7 @@ class PlaybackInstance
|
||||||
{
|
{
|
||||||
stepData_t step;
|
stepData_t step;
|
||||||
step.input = input;
|
step.input = input;
|
||||||
step.stateData = (uint8_t*) calloc(_emu->getStateSize(), 1);
|
step.stateData = (uint8_t*) malloc(_emu->getStateSize());
|
||||||
_emu->serializeState(step.stateData);
|
_emu->serializeState(step.stateData);
|
||||||
saveBlit(_emu->getInternalEmulator(), step.curBlit, hqn::HQNState::NES_VIDEO_PALETTE, 0, 0, 0, 0);
|
saveBlit(_emu->getInternalEmulator(), step.curBlit, hqn::HQNState::NES_VIDEO_PALETTE, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class PlaybackInstance
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initializes the playback module instance
|
// Initializes the playback module instance
|
||||||
PlaybackInstance(EmuInstance* emu, const std::string sequenceString, const std::string& overlayPath = "") : _emu(emu)
|
PlaybackInstance(EmuInstance* emu, const std::vector<std::string>& sequence, const std::string& overlayPath = "") : _emu(emu)
|
||||||
{
|
{
|
||||||
// Loading Emulator instance HQN
|
// Loading Emulator instance HQN
|
||||||
_hqnState.m_emu = _emu->getInternalEmulator();
|
_hqnState.m_emu = _emu->getInternalEmulator();
|
||||||
|
@ -43,10 +43,7 @@ class PlaybackInstance
|
||||||
_hqnState.m_emu->set_pixels(video_buffer, Nes_Emu::image_width+8);
|
_hqnState.m_emu->set_pixels(video_buffer, Nes_Emu::image_width+8);
|
||||||
|
|
||||||
// Building sequence information
|
// Building sequence information
|
||||||
const auto inputSequence = split(sequenceString, ' ');
|
for (const auto& input : sequence)
|
||||||
|
|
||||||
// Building sequence information
|
|
||||||
for (const auto& input : inputSequence)
|
|
||||||
{
|
{
|
||||||
// Adding new step
|
// Adding new step
|
||||||
addStep(input);
|
addStep(input);
|
||||||
|
|
|
@ -55,6 +55,9 @@ int main(int argc, char *argv[])
|
||||||
auto status = loadStringFromFile(inputSequence, sequenceFilePath.c_str());
|
auto status = loadStringFromFile(inputSequence, sequenceFilePath.c_str());
|
||||||
if (status == false) EXIT_WITH_ERROR("[ERROR] Could not find or read from sequence file: %s\n", sequenceFilePath.c_str());
|
if (status == false) EXIT_WITH_ERROR("[ERROR] Could not find or read from sequence file: %s\n", sequenceFilePath.c_str());
|
||||||
|
|
||||||
|
// Building sequence information
|
||||||
|
const auto sequence = split(inputSequence, ' ');
|
||||||
|
|
||||||
// Initializing terminal
|
// Initializing terminal
|
||||||
initializeTerminal();
|
initializeTerminal();
|
||||||
|
|
||||||
|
@ -70,13 +73,13 @@ int main(int argc, char *argv[])
|
||||||
auto e = EmuInstance(romFilePath, stateFilePath);
|
auto e = EmuInstance(romFilePath, stateFilePath);
|
||||||
|
|
||||||
// Creating playback instance
|
// Creating playback instance
|
||||||
auto p = PlaybackInstance(&e, inputSequence);
|
auto p = PlaybackInstance(&e, sequence);
|
||||||
|
|
||||||
// Flag to continue running playback
|
// Flag to continue running playback
|
||||||
bool continueRunning = true;
|
bool continueRunning = true;
|
||||||
|
|
||||||
// Variable for current step in view
|
// Variable for current step in view
|
||||||
ssize_t sequenceLength = p.getSequenceLength();
|
ssize_t sequenceLength = sequence.size();
|
||||||
ssize_t currentStep = 0;
|
ssize_t currentStep = 0;
|
||||||
|
|
||||||
// Flag to display frame information
|
// Flag to display frame information
|
||||||
|
@ -89,7 +92,7 @@ int main(int argc, char *argv[])
|
||||||
if (disableRender == false) p.renderFrame(currentStep);
|
if (disableRender == false) p.renderFrame(currentStep);
|
||||||
|
|
||||||
// Getting input
|
// Getting input
|
||||||
const auto& input = p.getInput(currentStep);
|
const auto& input = sequence[currentStep];
|
||||||
|
|
||||||
// Getting state data
|
// Getting state data
|
||||||
//const auto stateData = p.getStateData(currentStep);
|
//const auto stateData = p.getStateData(currentStep);
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#include "argparse/argparse.hpp"
|
||||||
|
#include "utils.hpp"
|
||||||
|
#include "emuInstance.hpp"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
nomalloc = environment({'MALLOC_PERTURB_': '0'})
|
||||||
|
|
||||||
|
# Adding game ending checks
|
||||||
|
endingChecker = executable('endingChecker', files(['endingChecker.cpp']), dependencies: [ quickerNESCoreDependency ] )
|
||||||
|
testSuite = [ 'gameEndings' ]
|
||||||
|
test('castlevania1AnyPercent', endingChecker, args : ['castlevania1AnyPercent.test'], suite: testSuite)
|
Loading…
Reference in New Issue