forked from Johnnyborov/ResourceManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_main.cpp
More file actions
30 lines (24 loc) · 905 Bytes
/
test_main.cpp
File metadata and controls
30 lines (24 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) 2018 Johnny Borov <JohnnyBorov@gmail.com>. Released under MIT License.
#include <iostream>
#include "ResourceManager/ResourceHandle.h"
void testInvalidResource() {
ResourceHandle rhdi("i_dont_exist"); // -DRM_NO_EXCEPTIONS to disable throw on invalid recource
std::cout << "rhdi is valid = " << rhdi.isValid() << '\n';
}
int main() {
try {
ResourceHandle rh1("res.txt");
ResourceHandle rh2("res2.txt");
std::cout << "rh1 c_str = " << rh1.c_str() << '\n';
std::cout << "rh2 string = " << rh2.string() << '\n';
ResourceHandle rh3("resources/res.txt");
std::cout << "rh3 is valid = " << rh3.isValid() << '\n';
std::cout << "rh3 data = " << rh3.data() << '\n';
std::cout << "rh3 size = " << rh3.size() << '\n';
testInvalidResource();
} catch (const ResourceNotFound& e) {
std::cout << e.what() << '\n';
}
std::cin.get();
return 0;
}