Skip to content

Commit

Permalink
remove need to make private methods public only for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ftorkler committed Sep 9, 2021
1 parent b50f1a8 commit 63664e6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ $(EXE): $(OBJ_DIR)/overlay.o $(OBJ) | $(BIN_DIR)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR)
$(CXX) $(CPPFLAGS) $(CFLAGS) -c $< -o $@

$(OBJ_DIR)/%.o: $(TEST_SRC_DIR)/%.cpp | $(OBJ_DIR)
$(CXX) -I3rdparty/acutest/include -DTEST_NO_MAIN $(CPPFLAGS) $(CFLAGS) -c $< -o $@

$(TEST_EXE): $(OBJ_DIR)/test.o ${TEST_OBJ} ${OBJ} | $(BIN_DIR)
$(CXX) $(LDFLAGS) $^ $(LDLIBS) -o $@

$(OBJ_DIR)/%.o: $(TEST_SRC_DIR)/%.cpp | $(OBJ_DIR)
$(CXX) -fno-access-control -I3rdparty/acutest/include -DTEST_NO_MAIN $(CPPFLAGS) $(CFLAGS) -c $< -o $@

$(OBJ_DIR)/test.o: $(TEST_SRC_DIR)/test.cpp | $(OBJ_DIR)
$(CXX) -I3rdparty/acutest/include $(CPPFLAGS) $(CFLAGS) -c $< -o $@
$(CXX) -fno-access-control -I3rdparty/acutest/include $(CPPFLAGS) $(CFLAGS) -c $< -o $@

$(BIN_DIR) $(OBJ_DIR):
@mkdir -p $@
Expand Down
13 changes: 7 additions & 6 deletions include/ansi.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ class Ansi
static Profile profileFromString(const std::string& input);

static Color toColor(const std::string &ansi, bool increaseIntensity = false, Profile profile = Profile::XP);
// visible for testing
static Color _to24bitColor(std::string code);
// visible for testing
static Color _to8bitColor(int code, Profile profile = Profile::XP);


static Sequence parseControlSequence(const std::string& text);

static std::vector<std::string> split(const std::string text);
// visible for testing

private:

static Color _to24bitColor(std::string code);
static Color _to8bitColor(int code, Profile profile = Profile::XP);

static void subsplit(const std::string& text, std::vector<std::string>* result);

};
Expand Down
11 changes: 5 additions & 6 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ class Config
static std::string getDefaultConfigFilePath();
static void exitWithUsage(int exitCode);

// visible for testing
static bool parseEmptyLine(std::string line);
static bool parseCommentLine(std::string line);
static bool parseSectionLine(std::string line, std::string& section);
static bool parseKeyValueLine(std::string line, std::string section, Config& config);

private:

Config();
Expand All @@ -56,6 +50,11 @@ class Config
static int assertIntParameter(char c, const std::string& param);
static std::string& trim(std::string& str);

static bool parseEmptyLine(std::string line);
static bool parseCommentLine(std::string line);
static bool parseSectionLine(std::string line, std::string& section);
static bool parseKeyValueLine(std::string line, std::string section, Config& config);

};

#endif // OVERLAY_CONFIG_H

0 comments on commit 63664e6

Please sign in to comment.