UnitTests: Introduce

Other than having a convenient framework to test our helpers, this
allows CodeQL code analysis GitHub action.

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
2022-03-07 14:14:29 +01:00
parent 3b110f7dc5
commit 017d5d5c99
11 changed files with 287 additions and 7 deletions

30
UnitTests/Shell.cpp Normal file
View File

@@ -0,0 +1,30 @@
/*
SPDX-License-Identifier: MIT
Copyright © 2022 Amebis
*/
#include "pch.h"
using namespace std;
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace UnitTests
{
TEST_CLASS(Shell)
{
public:
TEST_METHOD(PathCanonicalizeA)
{
string path;
Assert::IsTrue(::PathCanonicalizeA(path, "C:\\Windows\\Temp\\test\\.."));
Assert::AreEqual("C:\\Windows\\Temp", path.c_str(), true);
}
TEST_METHOD(PathCanonicalizeW)
{
wstring path;
Assert::IsTrue(::PathCanonicalizeW(path, L"C:\\Windows\\Temp\\test\\.."));
Assert::AreEqual(L"C:\\Windows\\Temp", path.c_str(), true);
}
};
}