2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
14 * Additional copyrights may follow
19 #include "ompi_config.h"
26 #include "opal/constants.h"
27 #include "opal/util/basename.h"
30 static void test(const char* in
, const char* out
);
33 int main(int argc
, char* argv
[])
35 test_init("opal_basename()");
37 test("foo.txt", "foo.txt");
38 test("/foo/bar/baz", "baz");
39 test("/yow.c", "yow.c");
42 test("foo.txt/", "foo.txt");
43 test("/foo/bar/baz/", "baz");
44 test("/yow.c/", "yow.c");
48 test("C:\\foo\\bar\\baz", "baz");
49 test("D:foo.txt", "foo.txt");
50 test("E:\\yow.c", "yow.c");
56 return test_finalize();
60 void test(const char* in
, const char* out
)
63 char *ret
= opal_basename(in
);
65 if (0 == strcmp(ret
, out
)) {
68 asprintf(&msg
, "Mismatch: input \"%s\", expected \"%s\", got \"%s\"\n",