Beispiel #1
0
int main(int argc, char **argv)
{
	// Fail
	printf("===FAIL===\n\n");
	std::vector<std::vector<char> > sources;
	populate_sources("test/fail%d.json", sources);
	int passed = 0;
	for (size_t i = 0; i < sources.size(); ++i)
	{
		printf("Parsing %d\n", i + 1);
		if (parse(&sources[i][0]))
		{
			++passed;
		}
	}
	printf("Passed %d from %d tests\n", passed, sources.size());

	// Pass
	sources.clear();
	printf("\n===PASS===\n\n");
	populate_sources("test/pass%d.json", sources);
	passed = 0;
	for (size_t i = 0; i < sources.size(); ++i)
	{
		printf("Parsing %d\n", i + 1);
		if (parse(&sources[i][0]))
		{
			++passed;
		}
	}
	printf("Passed %d from %d tests\n", passed, sources.size());

	return 0;
}
modelTan::modelTan(){
    vector<vector<char> > sources;
    sources.clear();

    populate_sources("2.txt", sources);

    for (size_t i = 0; i < sources.size(); ++i)
    {
        parse(&sources[i][0], INFOS_TRAFFIC);
    }
}
//Attention: les deux dernières valeurs du tableau correspondent aux horaires du prochain bus!!!
vector<Horaires> modelTan::getHoraires(int numBus, int direction){
    this->lHoraires.clear();
    vector<vector<char> > sources;
    sources.clear();
    populate_sources("1.txt", sources);

    for (size_t i = 0; i < sources.size(); ++i)
    {
        parse(&sources[i][0], HORAIRES);
    }

    return this->lHoraires;
}