diff options
author | Filippos Karapetis | 2009-02-17 10:33:16 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-02-17 10:33:16 +0000 |
commit | d6b5855800713f5f932c65e5239a0f96604ddbd5 (patch) | |
tree | 68eacc569abb72820d7ed5f5378daeafad9fb9ac /engines/sci/sfx/tests | |
parent | 7f8f0e96f7f72a6252e25c6abacb2ce98e39c395 (diff) | |
download | scummvm-rg350-d6b5855800713f5f932c65e5239a0f96604ddbd5.tar.gz scummvm-rg350-d6b5855800713f5f932c65e5239a0f96604ddbd5.tar.bz2 scummvm-rg350-d6b5855800713f5f932c65e5239a0f96604ddbd5.zip |
Removed more directories which are not part of the SCI engine - again, the code and documentation can be referenced from /vendor/freesci/glutton/src/sfx
svn-id: r38404
Diffstat (limited to 'engines/sci/sfx/tests')
-rw-r--r-- | engines/sci/sfx/tests/stubs.c | 9 | ||||
-rw-r--r-- | engines/sci/sfx/tests/tests.cpp | 162 | ||||
-rw-r--r-- | engines/sci/sfx/tests/tests.vcproj | 158 |
3 files changed, 0 insertions, 329 deletions
diff --git a/engines/sci/sfx/tests/stubs.c b/engines/sci/sfx/tests/stubs.c deleted file mode 100644 index 06da6f9419..0000000000 --- a/engines/sci/sfx/tests/stubs.c +++ /dev/null @@ -1,9 +0,0 @@ -int sciprintf(char *fmt,...) -{ - return 0; -} - -int sfx_pcm_available() -{ - return 1; -}
\ No newline at end of file diff --git a/engines/sci/sfx/tests/tests.cpp b/engines/sci/sfx/tests/tests.cpp deleted file mode 100644 index 0999d3615f..0000000000 --- a/engines/sci/sfx/tests/tests.cpp +++ /dev/null @@ -1,162 +0,0 @@ -#include <stdio.h> -#include <sfx_iterator.h> - -#define TESTEQUAL(x, y) if(x != y) printf("test failure: expected %04x, got %04x @ file %s line %d \n", x, y, __FILE__, __LINE__); - -static char calledDeathListenerCallback; - -static unsigned char song[] = { -// PCM not present - 0, -// channel defs - 0, 0x20, 0, 0x21, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -// note on, wait, note off - 0xAA, - 0x90, 0xAA, 0xAA, - 0xAA, - 0x80, 0xAA, 0xAA, - 0xAA, - 0x91, 0xAA, 0xAA, - 0xAA, - 0x81, 0xAA, 0xAA, - 0xAA, -// end track - 0xFC -}; - -#define SONG_CMD_COUNT 10 - -#define TEST_SETUP() \ - unsigned char cmds[4] = {0}; \ - int result = 0; \ - int message; \ - int i; \ -\ - song_iterator_t *it = songit_new(song, sizeof(song), 0, 0); \ - it->init(it); \ - SIMSG_SEND(it, SIMSG_SET_PLAYMASK(0x20));\ - calledDeathListenerCallback = 0; - -#define TEST_TEARDOWN() \ - songit_free(it); - - -void testFinishSong() { - TEST_SETUP(); - message = songit_next(&it, &cmds, &result, IT_READER_MASK_ALL); - TESTEQUAL(0xAA, message); - - message = songit_next(&it, &cmds, &result, IT_READER_MASK_ALL); - TESTEQUAL(0, message); - TESTEQUAL(3, result); - - for (i = 0; i < SONG_CMD_COUNT - 2; i++) { - message = songit_next(&it, &cmds, &result, IT_READER_MASK_ALL); - } - - TESTEQUAL(SI_FINISHED, message); - - TEST_TEARDOWN(); -} - - -void DeathListenerCallback(void *v1, void *v2) { - calledDeathListenerCallback++; - return; -} - -void testDeathListener() { - TEST_SETUP(); - - song_iterator_add_death_listener( - it, - it, - (void(*)(void *, void*))DeathListenerCallback); - - for (i = 0; i < SONG_CMD_COUNT; i++) { - message = songit_next(&it, &cmds, &result, IT_READER_MASK_ALL); - } - - TESTEQUAL(SI_FINISHED, message); - - TEST_TEARDOWN(); - - TESTEQUAL(1, calledDeathListenerCallback); -} - -void testMultipleDeathListeners() { - TEST_SETUP(); - - song_iterator_add_death_listener( - it, - it, - (void(*)(void *, void*))DeathListenerCallback); - - song_iterator_add_death_listener( - it, - it, - (void(*)(void *, void*))DeathListenerCallback); - - for (i = 0; i < SONG_CMD_COUNT; i++) { - message = songit_next(&it, &cmds, &result, IT_READER_MASK_ALL); - } - - TESTEQUAL(SI_FINISHED, message); - - TEST_TEARDOWN(); - - TESTEQUAL(2, calledDeathListenerCallback); -} - -void testStopSong() { - TEST_SETUP(); - SIMSG_SEND(it, SIMSG_STOP); - - message = songit_next(&it, &cmds, &result, IT_READER_MASK_ALL); - TESTEQUAL(SI_FINISHED, message); - - TEST_TEARDOWN(); -} - -void testStopLoopedSong() { - TEST_SETUP(); - - SIMSG_SEND(it, SIMSG_SET_LOOPS(3)); - message = songit_next(&it, &cmds, &result, IT_READER_MASK_ALL); - TESTEQUAL(0xAA, message); - - SIMSG_SEND(it, SIMSG_STOP); - message = songit_next(&it, &cmds, &result, IT_READER_MASK_ALL); - TESTEQUAL(SI_FINISHED, message); - - TEST_TEARDOWN(); -} - -void testChangeSongMask() { - TEST_SETUP(); - - message = songit_next(&it, &cmds, &result, IT_READER_MASK_ALL); - TESTEQUAL(0xAA, message); - - SIMSG_SEND(it, SIMSG_SET_PLAYMASK(0x40)); - message = songit_next(&it, &cmds, &result, IT_READER_MASK_ALL); - TESTEQUAL(0, message); - TESTEQUAL(0, result); - - TEST_TEARDOWN(); -} - - -int main(int argc, char* argv[]) { - testFinishSong(); - testDeathListener(); - testMultipleDeathListeners(); - testStopSong(); - testStopLoopedSong(); - testChangeSongMask(); - return 0; -} - diff --git a/engines/sci/sfx/tests/tests.vcproj b/engines/sci/sfx/tests/tests.vcproj deleted file mode 100644 index a50c794bce..0000000000 --- a/engines/sci/sfx/tests/tests.vcproj +++ /dev/null @@ -1,158 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="7.10" - Name="tests" - ProjectGUID="{3C6F6B16-D092-495C-B611-03FFDBFF27FC}" - Keyword="Win32Proj"> - <Platforms> - <Platform - Name="Win32"/> - </Platforms> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="1" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\include;..\..\include\win32" - PreprocessorDefinitions="PACKAGE=\"freesci\";HAVE_GETOPT_H;HAVE_LIBPNG;VERSION=__TIMESTAMP__;_DEBUG;WIN32;_CONSOLE;HAVE_STRING_H;HAVE_MEMCHR" - MinimalRebuild="TRUE" - BasicRuntimeChecks="3" - RuntimeLibrary="5" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4" - CompileAs="1"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="winmm.lib" - OutputFile="$(OutDir)/tests.exe" - LinkIncremental="2" - GenerateDebugInformation="TRUE" - ProgramDatabaseFile="$(OutDir)/tests.pdb" - SubSystem="1" - TargetMachine="1"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="1" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - RuntimeLibrary="4" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="winmm.lib" - OutputFile="$(OutDir)/tests.exe" - LinkIncremental="1" - GenerateDebugInformation="TRUE" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> - <File - RelativePath="..\..\sfx\iterator.c"> - </File> - <File - RelativePath="..\..\sfx\pcm-iterator.c"> - </File> - <File - RelativePath="..\..\scicore\sci_memory.c"> - </File> - <File - RelativePath=".\stubs.c"> - </File> - <File - RelativePath=".\tests.cpp"> - </File> - <File - RelativePath="..\..\scicore\tools.c"> - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> - <File - RelativePath="..\..\include\win32\sci_win32.h"> - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> - </Filter> - <File - RelativePath=".\ReadMe.txt"> - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> |