From f986d46c1c1d9a481ecba8f52be88c5bf7b072e6 Mon Sep 17 00:00:00 2001 From: Fredrik Hubinette Date: Wed, 7 Aug 2024 03:03:56 -0700 Subject: [PATCH] fix tests --- sound/sound_library.h | 4 +-- sound/tests.cpp | 58 ------------------------------------------- 2 files changed, 2 insertions(+), 60 deletions(-) diff --git a/sound/sound_library.h b/sound/sound_library.h index 5d9816f8b..42f06c378 100644 --- a/sound/sound_library.h +++ b/sound/sound_library.h @@ -93,7 +93,7 @@ class SoundLibrary { bool Play(SoundToPlay p) { return SOUNDQ->Play(p); } void Poll(RefPtr& player) {} - void init() { + static void init() { SOUNDQ->require_version(SoundLibraryVersion); } @@ -517,7 +517,7 @@ class SoundLibrary { class SoundLibraryV2 : public SoundLibrary { public: static const int SoundLibraryVersion = 2; - void init() { + static void init() { SOUNDQ->require_version(SoundLibraryVersion); } diff --git a/sound/tests.cpp b/sound/tests.cpp index 4bd7a281f..9391dfc88 100644 --- a/sound/tests.cpp +++ b/sound/tests.cpp @@ -373,64 +373,6 @@ void test_playwav() { CHECK_EQ(1023, readallsamples(&wav)); } -template -class SoundLibraryTemplate { -public: - static const int SoundLibraryVersion = 1; -}; - -template -class SoundLibraryV2Template : public SoundLibraryTemplate { -public: - static const int SoundLibraryVersion = 2; -}; - -template -class SoundLibraryV3Template : public SoundLibraryV2Template { -public: - static const int SoundLibraryVersion = 3; -}; - -template -class SoundLibraryV4Template : public SoundLibraryV3Template { -public: - static const int SoundLibraryVersion = 4; -}; - -template -class SoundLibraryV5Template : public SoundLibraryV4Template { -public: - static const int SoundLibraryVersion = 5; -}; - -#include "../common/malloc_helper.h" - -#define SOUND_SOUND_LIBRARY_H - -#include "sound_library.h" -static_assert(MKSPEC::SoundLibrary::SoundLibraryVersion == 1); - -template -struct FOOSPEC { - static const int fnord = 17; - typedef SoundLibraryTemplate SoundLibrary; -}; -#define MENU_SPEC_TEMPLATE FOOSPEC -#define MIN_SOUND_LIBRARY_VERSION 2 -#include "sound_library.h" -static_assert(MKSPEC::SoundLibrary::SoundLibraryVersion == 2); -static_assert(MKSPEC::fnord == 17); - -#define MIN_SOUND_LIBRARY_VERSION 1 -#include "sound_library.h" -static_assert(MKSPEC::SoundLibrary::SoundLibraryVersion == 2); -static_assert(MKSPEC::fnord == 17); - -#define MIN_SOUND_LIBRARY_VERSION 3 -#include "sound_library.h" -static_assert(MKSPEC::SoundLibrary::SoundLibraryVersion == 3); -static_assert(MKSPEC::fnord == 17); - int main() { test_effects(); test_playwav();