summaryrefslogtreecommitdiff
path: root/sntp/tests/sntptest.h
diff options
context:
space:
mode:
Diffstat (limited to 'sntp/tests/sntptest.h')
-rw-r--r--sntp/tests/sntptest.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/sntp/tests/sntptest.h b/sntp/tests/sntptest.h
new file mode 100644
index 0000000..d5add9c
--- /dev/null
+++ b/sntp/tests/sntptest.h
@@ -0,0 +1,35 @@
+#ifndef SNTPTEST_H
+#define SNTPTEST_H
+
+#include "tests_main.h"
+
+extern "C" {
+#include "ntp_stdlib.h"
+#include "sntp-opts.h"
+};
+
+class sntptest : public ntptest {
+protected:
+ sntptest() {
+ optionSaveState(&sntpOptions);
+ }
+
+ ~sntptest() {
+ optionRestore(&sntpOptions);
+ }
+
+ void ActivateOption(const char* option, const char* argument) {
+ const int ARGV_SIZE = 4;
+
+ char* opts[ARGV_SIZE];
+
+ opts[0] = estrdup("sntpopts");
+ opts[1] = estrdup(option);
+ opts[2] = estrdup(argument);
+ opts[3] = estrdup("127.0.0.1");
+
+ optionProcess(&sntpOptions, ARGV_SIZE, opts);
+ }
+};
+
+#endif // SNTPTEST_H