headers/bsd: Add sys/queue.h.
[haiku.git] / src / tests / servers / launch / UtilityTest.cpp
bloba995258cf37d28af650b3683214690f2788df310
1 /*
2 * Copyright 2015, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
4 */
7 #include "UtilityTest.h"
9 #include <stdlib.h>
11 #include <cppunit/TestCaller.h>
12 #include <cppunit/TestSuite.h>
14 #include "Utility.h"
17 UtilityTest::UtilityTest()
22 UtilityTest::~UtilityTest()
27 void
28 UtilityTest::TestTranslatePath()
30 CPPUNIT_ASSERT_EQUAL(BString("/boot/home/test"),
31 Utility::TranslatePath("$HOME/test"));
32 CPPUNIT_ASSERT_EQUAL(BString("/boot/home/test"),
33 Utility::TranslatePath("${HOME}/test"));
34 CPPUNIT_ASSERT_EQUAL(BString("--/boot/home--"),
35 Utility::TranslatePath("--${HOME}--"));
36 CPPUNIT_ASSERT_EQUAL(BString("$(HOME)/test"),
37 Utility::TranslatePath("$(HOME)/test"));
38 CPPUNIT_ASSERT_EQUAL(BString("/boot/home/test"),
39 Utility::TranslatePath("~/test"));
40 CPPUNIT_ASSERT_EQUAL(BString("~baron/test"),
41 Utility::TranslatePath("~baron/test"));
42 CPPUNIT_ASSERT_EQUAL(BString("/~/test"),
43 Utility::TranslatePath("/~/test"));
47 /*static*/ void
48 UtilityTest::AddTests(BTestSuite& parent)
50 CppUnit::TestSuite& suite = *new CppUnit::TestSuite("UtilityTest");
52 suite.addTest(new CppUnit::TestCaller<UtilityTest>(
53 "UtilityTest::TestTranslatePath", &UtilityTest::TestTranslatePath));
55 parent.addTest("UtilityTest", &suite);