Files
archived-Detours/tests/test_image_api.cpp
Brian Gianforcaro 2de2babb25 Tests: Add initial set of unit tests for Detours (#137)
- Import the Catch2 self-contained C++ test framework.
  It's used by many Microsoft OSS projects:
  - https://github.com/microsoft/cppwinrt/tree/master/test
  - https://github.com/microsoft/wil/tree/master/tests
  As well as many OSS projects in general.

  When the CMake PR is merged, we can remove this as
  a checked in development dependency, and can instead
  download it using CMake.

- Start basic set of unit tests to validate failure modes of

- Hook the execution into the existing NMake build system.

- Hook test execution into CI pipeline
2020-12-01 16:16:13 -08:00

22 lines
625 B
C++

//////////////////////////////////////////////////////////////////////////////
//
// Unit Tests for Detours Image API (test_image_api.cpp of unittests.exe)
//
// Microsoft Research Detours Package
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
#include "catch.hpp"
#include "windows.h"
#include "detours.h"
TEST_CASE("DetourBinaryOpen", "[image]")
{
SECTION("Passing INVALID_HANDLE, results in error")
{
auto binary = DetourBinaryOpen(INVALID_HANDLE_VALUE);
REQUIRE( GetLastError() == ERROR_INVALID_HANDLE );
REQUIRE( binary == nullptr );
}
}