1/// @file
2/// @brief Base class for device under test
3
4#ifndef DUT_HH
5#define DUT_HH
6#include <stdexcept>
7#include <string>
8
9#include "prod.hh"
10
11namespace dut {
12
13struct failure : public std::exception {
14 std::string errstr;
15 std::string sqlstate;
16 const char *what() const throw() {
17 return errstr.c_str();
18 }
19 failure(const char *s, const char *sqlstate_ = "") throw() : errstr(), sqlstate() {
20 errstr = s;
21 sqlstate = sqlstate_;
22 };
23};
24
25struct broken : failure {
26 broken(const char *s, const char *sqlstate_ = "") throw() : failure(s, sqlstate_) {
27 }
28};
29
30struct timeout : failure {
31 timeout(const char *s, const char *sqlstate_ = "") throw() : failure(s, sqlstate_) {
32 }
33};
34
35struct syntax : failure {
36 syntax(const char *s, const char *sqlstate_ = "") throw() : failure(s, sqlstate_) {
37 }
38};
39
40} // namespace dut
41
42struct dut_base {
43 std::string version;
44 virtual void test(const std::string &stmt) = 0;
45};
46
47#endif
48