Add tests for C++ unit test library
[dejagnu.git] / testsuite / libdejagnu / unit-cxx.cxx
blobfecf550c8f02a6a7d4ff5c0ac24f176e551e9a59
1 // Exerciser for Dejagnu C++ unit test support library
2 //
3 // Copyright (C) 2022 Free Software Foundation, Inc.
4 //
5 // This file is part of DejaGnu.
6 //
7 // DejaGnu is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3 of the License, or
10 // (at your option) any later version.
12 // DejaGnu is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with DejaGnu; if not, write to the Free Software Foundation,
19 // Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
21 // This file was written by Jacob Bachmeyer.
23 #include <cstring>
24 #include <iostream>
26 #include "dejagnu.h"
28 TestState DGT;
30 int
31 main(int argc, char ** argv)
33 if (argc < 2) {
34 std::cerr <<"usage: " <<argv[0] <<" <test name>..."<<std::endl
35 <<"see source for details" <<std::endl;
36 return 2;
39 for (int i = 1; i < argc; i++ ) {
40 if (!std::strcmp("pass", argv[i])) DGT.pass("test");
41 else if (!std::strcmp("xpass", argv[i])) DGT.xpass("test");
42 else if (!std::strcmp("fail", argv[i])) DGT.fail("test");
43 else if (!std::strcmp("xfail", argv[i])) DGT.xfail("test");
44 else if (!std::strcmp("untested", argv[i])) DGT.untested("test");
45 else if (!std::strcmp("unresolved", argv[i])) DGT.unresolved("test");
46 else if (!std::strcmp("unsupported", argv[i])) DGT.unsupported("test");
47 else if (!std::strcmp("note", argv[i])) DGT.note("test");
48 else {
49 std::cerr <<argv[0] <<": " <<"unknown test `" <<argv[i] <<"'" <<std::endl;
50 return 2;
54 return 0;
57 // EOF