-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
28 lines (25 loc) · 702 Bytes
/
main.cpp
File metadata and controls
28 lines (25 loc) · 702 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
#include <gtest/gtest.h>
#include <iostream>
#include <stdexcept>
#include "main.h"
int myFunction(int x)
{
if(x <= 0)
throw std::runtime_error("error");
return x+1;
}
int setConfig(std::string deviceName, std::string flag)
{
std::cout << "Parameters: " << deviceName << " - " << flag << std::endl;
if(deviceName != "CPU" && deviceName != "GPU" && deviceName != "AUTO")
throw std::runtime_error("Invalid Device");
if(flag != "YES" && flag != "NO")
throw std::runtime_error("Invalid flag");
std::cout << "Set device-flag " << "[" << deviceName << "-" << flag << "]\n";
return 0;
}
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}