added test for ModDescription class
parent
4fcfd6787d
commit
7fac9bd6e2
|
@ -35,12 +35,12 @@ int ModDescription::getReleaseNr() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ModDescription::getNextDependency() {
|
std::string ModDescription::getNextDependency() {
|
||||||
if(_depsIterator + 2 < _deps.size()) {
|
if(_depsIterator + 1 < _deps.size()) {
|
||||||
_depsIterator++;
|
_depsIterator++;
|
||||||
return _deps[_depsIterator];
|
return _deps[_depsIterator];
|
||||||
} else {
|
} else {
|
||||||
_depsAtEnd = true;
|
_depsAtEnd = true;
|
||||||
return "getNextDependency failed...";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,10 +79,13 @@ void ModDescription::setRepositoryAddress(std::string repoaddr) {
|
||||||
_repoaddr = repoaddr;
|
_repoaddr = repoaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetDependencyIterator() {
|
void ModDescription::resetDependencyIterator() {
|
||||||
_depsIterator = -1;
|
_depsIterator = -1;
|
||||||
|
if(_depsAtEnd == true) {
|
||||||
|
_depsAtEnd = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dependenciesEnd() {
|
bool ModDescription::dependenciesEnd() {
|
||||||
return _depsAtEnd;
|
return _depsAtEnd;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
/// \namespace mmm
|
/// \namespace mmm
|
||||||
/// \brief A global namespace for 3m
|
/// \brief A global namespace for 3m
|
||||||
namespace mmm }
|
namespace mmm {
|
||||||
/// \class ModDescription
|
/// \class ModDescription
|
||||||
/// \brief A class describing a mod.
|
/// \brief A class describing a mod.
|
||||||
class ModDescription {
|
class ModDescription {
|
||||||
|
@ -30,7 +30,7 @@ public:
|
||||||
///< \return Mod name.
|
///< \return Mod name.
|
||||||
std::string getDescription(); ///< \brief A function returning mod description.
|
std::string getDescription(); ///< \brief A function returning mod description.
|
||||||
///< \return Mod description.
|
///< \return Mod description.
|
||||||
std::string getReleaseNr(); ///< \brief A function returning 3m package release number.
|
int getReleaseNr(); ///< \brief A function returning 3m package release number.
|
||||||
///< \return 3m package release number.
|
///< \return 3m package release number.
|
||||||
std::string getNextDependency(); ///< \brief A function returning next dependency from the dependency list.
|
std::string getNextDependency(); ///< \brief A function returning next dependency from the dependency list.
|
||||||
///< \return Next dependency from the dependency list.
|
///< \return Next dependency from the dependency list.
|
||||||
|
|
2
OBJECTS
2
OBJECTS
|
@ -1,5 +1,5 @@
|
||||||
ModDescription: name, description, release, deps, repotype, repoaddr
|
ModDescription: name, description, release, deps, repotype, repoaddr
|
||||||
ModList: name, vector<ModDescription>
|
ModList: ModListDescription, vector<ModDescription>
|
||||||
LocalModDescription: ModDescription + remoteModlist (inheritance)
|
LocalModDescription: ModDescription + remoteModlist (inheritance)
|
||||||
LocalModList: vector<LocalModDescription>
|
LocalModList: vector<LocalModDescription>
|
||||||
RepositoryModDescription: ModDescription + path (inheritance)
|
RepositoryModDescription: ModDescription + path (inheritance)
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,7 +1,9 @@
|
||||||
CXXFLAGS=-Wall
|
CXXFLAGS=-Wall
|
||||||
all:
|
all:
|
||||||
${CXX} ${CXXFLAGS} -o ConfigFileTest ConfigFileTest.cpp ../ConfigFile.cpp ../3mExceptions.cpp
|
${CXX} ${CXXFLAGS} -o ConfigFileTest ConfigFileTest.cpp ../ConfigFile.cpp ../3mExceptions.cpp
|
||||||
|
${CXX} ${CXXFLAGS} -o ModDescriptionTest ModDescriptionTest.cpp ../ModDescription.cpp
|
||||||
debug:
|
debug:
|
||||||
${CXX} ${CXXFLAGS} -o ConfigFileTest ConfigFileTest.cpp ../ConfigFile.cpp ../3mExceptions.cpp -g
|
${CXX} ${CXXFLAGS} -o ConfigFileTest ConfigFileTest.cpp ../ConfigFile.cpp ../3mExceptions.cpp -g
|
||||||
|
${CXX} ${CXXFLAGS} -o ModDescriptionTest ModDescriptionTest.cpp ../ModDescription.cpp -g
|
||||||
clean:
|
clean:
|
||||||
rm -rf ConfigFileTest
|
rm -rf ConfigFileTest ModDescriptionTest
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include "../ModDescription.h"
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
mmm::ModDescription md;
|
||||||
|
md.setName("test");
|
||||||
|
md.setDescription("Test ModDescription entry");
|
||||||
|
md.setReleaseNr(1);
|
||||||
|
md.setRepositoryType("archive");
|
||||||
|
md.setRepositoryAddress("http://example.tld/mod.zip");
|
||||||
|
md.insertDependency("test2");
|
||||||
|
md.insertDependency("test3");
|
||||||
|
cout << "Name: " << md.getName() << endl << "Description: " << md.getDescription() << endl << "Release number: " << md.getReleaseNr() << endl << "Depends on: ";
|
||||||
|
while(!md.dependenciesEnd()) {
|
||||||
|
cout << md.getNextDependency() << " ";
|
||||||
|
}
|
||||||
|
cout << endl << "Dependencies again: ";
|
||||||
|
md.resetDependencyIterator();
|
||||||
|
while(!md.dependenciesEnd()) {
|
||||||
|
cout << md.getNextDependency() << " ";
|
||||||
|
}
|
||||||
|
cout << endl << "Repository type: " << md.getRepositoryType() << endl << "Repository address: " << md.getRepositoryAddress() << endl;
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
Loading…
Reference in New Issue