aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/testkit/testapp.h
blob: bfa322ccac573186b8cf80de7a64a54e7ac293bc (plain) (blame)
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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "test_kit.h"

#define TEST_INIT(name) do { TEST_MASTER.init(name); } while(false)
#define TEST_DONE() do { return TEST_MASTER.fini() ? 0 : 1; } while(false)

#define TEST_APPHOOK(app) \
  int main(int argc, char **argv) \
  { \
    app myapp; \
    return myapp.Entry(argc, argv); \
  }
#define TEST_SETUP(test) \
  class test : public vespalib::TestApp \
  { \
    public: int Main() override; \
  }; \
  TEST_APPHOOK(test)

namespace vespalib {

class TestApp
{
public:
    int _argc = 0;
    char **_argv = nullptr;

    virtual int Main() = 0;
    int Entry(int argc, char **argv);
    virtual ~TestApp();
};

} // namespace vespalib