-
Notifications
You must be signed in to change notification settings - Fork 13
/
test.cpp
35 lines (31 loc) · 928 Bytes
/
test.cpp
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
31
32
33
34
35
#include <iostream>
#include <string>
#define POSTJECT_SENTINEL_FUSE "NODE_JS_FUSE_fce680ab2cc467b6e072b8b5df1996b2"
#include "../dist/postject-api.h"
int main() {
size_t size = 0;
if (postject_has_resource()) {
const void* ptr = postject_find_resource("foobar", &size, nullptr);
if (ptr == NULL) {
std::cerr << "ptr must not be NULL." << std::endl;
exit(1);
}
if (size == 0) {
std::cerr << "size must not be 0." << std::endl;
exit(1);
}
std::cout << std::string(static_cast<const char*>(ptr), size) << std::endl;
} else {
const void* ptr = postject_find_resource("foobar", &size, nullptr);
if (ptr != nullptr) {
std::cerr << "ptr must be nullptr." << std::endl;
exit(1);
}
if (size > 0) {
std::cerr << "size must not be greater than 0." << std::endl;
exit(1);
}
std::cout << "Hello world" << std::endl;
}
return 0;
}