libBeatsaber/tests/main.cpp

58 lines
1.6 KiB
C++
Raw Normal View History

2021-05-30 21:56:21 +02:00
#include <stdio.h>
#include "test.h"
#include "beatmap.h"
2021-06-04 20:27:20 +02:00
#include "beatsaber.h"
2021-05-30 21:56:21 +02:00
//tests
2021-06-01 11:47:41 +02:00
int difficulties_test();
int characteristics_test();
2021-05-30 21:56:21 +02:00
2021-06-01 11:47:41 +02:00
test_t tests[] = {
difficulties_test, characteristics_test,
NULL};
2021-05-30 21:56:21 +02:00
int main(int argc, char** argv) {
test_t* current = tests;
int failcount = 0;
int testcount = 0;
for(; *current; current++) {
testcount++;
printf("\033[1mRunning test number: %d ", testcount);
if((*current)()) {
printf("\033[1;92msucceeded\033[0;1m!\n");
} else {
printf("\033[1;91mfailed\033[0;1m\n");
failcount++;
}
}
printf("\033[1;93m%d\033[0;1m/%d failed\n", failcount, testcount);
2021-06-04 20:27:20 +02:00
//beatsaber installation dir discovery test
std::string installdir = Beatsaber::findBeatsaberInstallation();
std::cout << "Beatsaber installation directory: " << installdir << std::endl;
2021-06-12 18:04:14 +02:00
auto list = Beatsaber::loadMapsfromInstallation();
std::cout << "Loaded: " << list.size() << " Maps from Beatsaber Installation" << std::endl;
/*for(auto i : list) {
if(i) {
i->printDebug();
std::cin.get();
}
}*/
2021-05-30 21:56:21 +02:00
//simple read test
2021-06-12 18:04:14 +02:00
/*std::shared_ptr<Beatsaber::BeatMap> bmap = Beatsaber::BeatMap::loadFromFolder("/home/yannis/Nextcloud/yannis/Beatsaber/BeatSaverLevel/1dd (Portal - Still Alive (Uppermost Remix) - kryptikos)");
2021-05-30 21:56:21 +02:00
if(!bmap) std::cout << "Could not load File" << std::endl;
else bmap->printDebug();
2021-06-04 13:15:13 +02:00
bmap = Beatsaber::BeatMap::loadFromZip("/home/yannis/Nextcloud/yannis/Beatsaber/BeatSaverLevel/18b92 (Empress of Light - ShadowLantern).zip");
if(!bmap) std::cout << "Could not load File" << std::endl;
else bmap->printDebug();
2021-06-12 18:04:14 +02:00
*/
2021-05-30 21:56:21 +02:00
return failcount > 0;
}