diff --git a/includes/RhythmGameUtilities/Enums/Difficulty.h b/includes/RhythmGameUtilities/Enums/Difficulty.h index b794833..3f3a5f6 100644 --- a/includes/RhythmGameUtilities/Enums/Difficulty.h +++ b/includes/RhythmGameUtilities/Enums/Difficulty.h @@ -1,19 +1,40 @@ #pragma once +#include + namespace RhythmGameUtilities { enum Difficulty { + // Easy Difficulty Easy, + // Medium Difficulty Medium, + // Hard Difficulty Hard, + // Expert Difficulty Expert }; +std::string ToString(Difficulty difficulty) +{ + switch (difficulty) + { + case Easy: + return "Easy"; + case Medium: + return "Medium"; + case Hard: + return "Hard"; + case Expert: + return "Expert"; + } +} + } // namespace RhythmGameUtilities diff --git a/includes/RhythmGameUtilities/Enums/NamedSection.h b/includes/RhythmGameUtilities/Enums/NamedSection.h index fe309b3..7c1d2dd 100644 --- a/includes/RhythmGameUtilities/Enums/NamedSection.h +++ b/includes/RhythmGameUtilities/Enums/NamedSection.h @@ -5,25 +5,29 @@ namespace RhythmGameUtilities { -namespace NamedSection +enum NamedSection { -typedef std::string Type; + /// Song information + Song, -/// -/// Song information -/// -Type Song = "Song"; + /// Track information used for syncing with music and notes like BPM + SyncTrack, -/// -/// Track information used for syncing with music and notes like BPM -/// -Type SyncTrack = "SyncTrack"; + /// Track events + Events +}; -/// -/// Track events -/// -Type Events = "Events"; - -}; // namespace NamedSection +std::string ToString(NamedSection namedSection) +{ + switch (namedSection) + { + case Song: + return "Song"; + case SyncTrack: + return "SyncTrack"; + case Events: + return "Events"; + } +} } // namespace RhythmGameUtilities diff --git a/includes/RhythmGameUtilities/Enums/TypeCode.h b/includes/RhythmGameUtilities/Enums/TypeCode.h index 3e33325..7502f2d 100644 --- a/includes/RhythmGameUtilities/Enums/TypeCode.h +++ b/includes/RhythmGameUtilities/Enums/TypeCode.h @@ -5,30 +5,36 @@ namespace RhythmGameUtilities { -namespace TypeCode +enum TypeCode { -typedef std::string Type; -/// -/// BPM Marker -/// -Type BPM = "B"; + /// BPM Marker + BPM, -/// -/// Time Signature Marker -/// -Type TimeSignature = "TS"; + /// Time Signature Marker + TimeSignature, -/// -/// Note Marker -/// -Type Note = "N"; + /// Note Marker + Note, -/// -/// Event Marker -/// -Type Event = "E"; + /// Event Marker + Event -} // namespace TypeCode +}; + +std::string ToString(TypeCode typeCode) +{ + switch (typeCode) + { + case BPM: + return "B"; + case TimeSignature: + return "TS"; + case Note: + return "N"; + case Event: + return "E"; + } +} } // namespace RhythmGameUtilities diff --git a/tests/RhythmGameUtilities/Enum.cpp b/tests/RhythmGameUtilities/Enum.cpp new file mode 100644 index 0000000..f2856e2 --- /dev/null +++ b/tests/RhythmGameUtilities/Enum.cpp @@ -0,0 +1,46 @@ +#include +#include + +#include "RhythmGameUtilities/Enums/Difficulty.h" +#include "RhythmGameUtilities/Enums/NamedSection.h" +#include "RhythmGameUtilities/Enums/TypeCode.h" + +using namespace RhythmGameUtilities; + +void testDifficulty() +{ + assert(ToString(Difficulty::Easy) == "Easy"); + assert(ToString(Difficulty::Medium) == "Medium"); + assert(ToString(Difficulty::Hard) == "Hard"); + assert(ToString(Difficulty::Expert) == "Expert"); + + std::cout << "."; +} + +void testNamedSection() +{ + assert(ToString(NamedSection::Song) == "Song"); + assert(ToString(NamedSection::SyncTrack) == "SyncTrack"); + assert(ToString(NamedSection::Events) == "Events"); + + std::cout << "."; +} + +void testTypeCode() +{ + assert(ToString(TypeCode::BPM) == "B"); + assert(ToString(TypeCode::TimeSignature) == "TS"); + assert(ToString(TypeCode::Note) == "N"); + assert(ToString(TypeCode::Event) == "E"); + + std::cout << "."; +} + +int main() +{ + testDifficulty(); + testNamedSection(); + testTypeCode(); + + return 0; +}