1/* 2 * Copyright 2020, Andrew Lindesay <apl@lindesay.co.nz>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5#include "StorageUtilsTest.h" 6 7#include <String.h> 8 9#include <cppunit/TestCaller.h> 10#include <cppunit/TestSuite.h> 11 12#include "StorageUtils.h" 13 14 15StorageUtilsTest::StorageUtilsTest() 16{ 17} 18 19 20StorageUtilsTest::~StorageUtilsTest() 21{ 22} 23 24 25void 26StorageUtilsTest::TestSwapExtensionOnPathComponent() 27{ 28 const BString input = "/paved/path.tea"; 29 30// ---------------------- 31 BString output = StorageUtils::SwapExtensionOnPathComponent(input, "chai"); 32// ---------------------- 33 34 const BString expected = "/paved/path.chai"; 35 CPPUNIT_ASSERT_EQUAL(expected, output); 36} 37 38 39/*static*/ void 40StorageUtilsTest::AddTests(BTestSuite& parent) 41{ 42 CppUnit::TestSuite& suite = *new CppUnit::TestSuite("StorageUtilsTest"); 43 44 suite.addTest( 45 new CppUnit::TestCaller<StorageUtilsTest>( 46 "StorageUtilsTest::TestSwapExtensionOnPathComponent", 47 &StorageUtilsTest::TestSwapExtensionOnPathComponent)); 48 49 parent.addTest("StorageUtilsTest", &suite); 50}