summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2018-06-06 19:00:12 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2018-06-06 19:13:41 +0200
commit7418abaeb3130423bedd6bcb3cef0eb2565ed5d6 (patch)
tree4991351a7e53a0a846c1447e9fe3ffabb31b6acc /src
parent718e8db44d984a97c032dccfe95e3f4707c0835a (diff)
Added unit-test for InstrumentParser.
Diffstat (limited to 'src')
-rw-r--r--src/audiofile.h2
-rw-r--r--src/instrument.h9
-rw-r--r--src/rangemap.h1
-rw-r--r--src/sample.h6
4 files changed, 14 insertions, 4 deletions
diff --git a/src/audiofile.h b/src/audiofile.h
index d73dad8..3bc1ac0 100644
--- a/src/audiofile.h
+++ b/src/audiofile.h
@@ -68,6 +68,8 @@ public:
std::size_t filechannel;
private:
+ friend class InstrumentParserTest;
+
void* magic{nullptr};
volatile bool is_loaded{false};
InstrumentChannel* instrument_channel;
diff --git a/src/instrument.h b/src/instrument.h
index 0441ed4..e18c14a 100644
--- a/src/instrument.h
+++ b/src/instrument.h
@@ -42,8 +42,6 @@
class Instrument
{
- friend class InstrumentParser;
- friend class DrumKitParser;
public:
Instrument(Settings& settings, Random& rand);
~Instrument();
@@ -66,6 +64,13 @@ public:
std::size_t getNumberOfFiles() const;
private:
+ // For parser:
+ friend class InstrumentParser;
+ friend class DrumKitParser;
+
+ // For unit-tests:
+ friend class InstrumentParserTest;
+
void* magic;
std::string _group;
diff --git a/src/rangemap.h b/src/rangemap.h
index 4c427e7..e53cbe8 100644
--- a/src/rangemap.h
+++ b/src/rangemap.h
@@ -37,6 +37,7 @@ public:
std::vector<T2> get(T1 at);
private:
+ friend class InstrumentParserTest;
std::multimap<std::pair<T1, T1>, T2> values;
};
diff --git a/src/sample.h b/src/sample.h
index e9cbf18..7eb4076 100644
--- a/src/sample.h
+++ b/src/sample.h
@@ -36,8 +36,6 @@ using AudioFiles = std::map<const InstrumentChannel*, AudioFile*>;
class Sample
{
- friend class InstrumentParser;
- friend class PowerList;
public:
Sample(const std::string& name, float power);
~Sample();
@@ -45,6 +43,10 @@ public:
AudioFile* getAudioFile(const Channel& channel);
private:
+ friend class InstrumentParser;
+ friend class PowerList;
+ friend class InstrumentParserTest;
+
void addAudioFile(InstrumentChannel* instrument_channel,
AudioFile* audio_file);