-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_example.cpp
More file actions
35 lines (27 loc) · 1.28 KB
/
test_example.cpp
File metadata and controls
35 lines (27 loc) · 1.28 KB
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 "voiceit3.hpp"
#include <iostream>
#include <cstdlib>
#include <string>
int main() {
const char* ak = std::getenv("VOICEIT_API_KEY");
const char* at = std::getenv("VOICEIT_API_TOKEN");
if (!ak || !at) { std::cout << "Set VOICEIT_API_KEY and VOICEIT_API_TOKEN" << std::endl; return 1; }
voiceit3 vi(ak, at);
std::string phrase = "Never forget tomorrow is a new day";
std::string td = "test-data";
std::string r = vi.CreateUser();
std::cout << "CreateUser: " << (r.find("SUCC") != std::string::npos ? "PASS" : "FAIL") << std::endl;
// Extract userId (simple parse)
size_t pos = r.find("usr_");
std::string userId = r.substr(pos, 36);
for (int i = 1; i <= 3; i++) {
r = vi.CreateVideoEnrollment(userId, "en-US", phrase, td + "/videoEnrollmentA" + std::to_string(i) + ".mov");
std::cout << "VideoEnrollment" << i << ": " << (r.find("SUCC") != std::string::npos ? "PASS" : "FAIL") << std::endl;
}
r = vi.VideoVerification(userId, "en-US", phrase, td + "/videoVerificationA1.mov");
std::cout << "VideoVerification: " << (r.find("SUCC") != std::string::npos ? "PASS" : "FAIL") << std::endl;
vi.DeleteAllEnrollments(userId);
vi.DeleteUser(userId);
std::cout << "\nAll tests passed!" << std::endl;
return 0;
}