зеркало из https://github.com/Azure/c-pal.git
added win32 reals
This commit is contained in:
Родитель
1b13ec4388
Коммит
031003e6c9
|
@ -0,0 +1,17 @@
|
|||
#Copyright (c) Microsoft. All rights reserved.
|
||||
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
|
||||
|
||||
set(reals_win32_c_files
|
||||
real_threadapi.c
|
||||
real_interlocked_hl_win32.c
|
||||
real_srw_lock_win32.c
|
||||
real_string_utils_win32.c
|
||||
real_timer_win32.c
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/../../src)
|
||||
add_library(reals_win32 ${reals_win32_c_files})
|
||||
target_link_libraries(reals_win32 reals_interface)
|
|
@ -0,0 +1,7 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
#define GBALLOC_H
|
||||
|
||||
#include "real_interlocked_hl_renames.h"
|
||||
|
||||
#include "interlocked_hl_win32.c"
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
#define GBALLOC_H
|
||||
|
||||
#include "real_string_utils_renames.h"
|
||||
#include "real_timer_renames.h"
|
||||
|
||||
#include "real_srw_lock_renames.h"
|
||||
|
||||
#include "srw_lock_win32.c"
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
#define GBALLOC_H
|
||||
|
||||
#include "real_string_utils_renames.h"
|
||||
|
||||
#include "string_utils.c"
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
#define GBALLOC_H
|
||||
|
||||
#include "real_threadapi_renames.h"
|
||||
|
||||
#include "threadapi_win32.c"
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
#define GBALLOC_H
|
||||
|
||||
#include "real_timer_renames.h"
|
||||
|
||||
#include "timer.c"
|
|
@ -0,0 +1,10 @@
|
|||
#Copyright (c) Microsoft. All rights reserved.
|
||||
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
set(theseTestsName reals_win32_ut)
|
||||
|
||||
set(${theseTestsName}_test_files
|
||||
${theseTestsName}.c
|
||||
)
|
||||
|
||||
build_c_tests(${theseTestsName} ON "tests/azure_c_pal/win32" ADDITIONAL_LIBS pal_win32 reals_win32)
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
#include <stddef.h>
|
||||
#include "testrunnerswitcher.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
size_t failedTestCount = 0;
|
||||
RUN_TEST_SUITE(reals_win32_ut, failedTestCount);
|
||||
return failedTestCount;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
#include "testrunnerswitcher.h"
|
||||
|
||||
#define REGISTER_GLOBAL_MOCK_HOOK(original, real) \
|
||||
(original == real) ? (void)0 : (void)1;
|
||||
|
||||
#include "threadapi.h"
|
||||
#include "srw_lock.h"
|
||||
#include "string_utils.h"
|
||||
#include "timer.h"
|
||||
#include "interlocked_hl.h"
|
||||
|
||||
#include "real_threadapi.h"
|
||||
#include "real_srw_lock.h"
|
||||
#include "real_string_utils.h"
|
||||
#include "real_timer.h"
|
||||
#include "real_interlocked_hl.h"
|
||||
|
||||
BEGIN_TEST_SUITE(reals_win32_ut)
|
||||
|
||||
// this test makes sure that the mappings work
|
||||
// (there is a real_ function corresponding to the original)
|
||||
TEST_FUNCTION(check_all_c_pal_reals)
|
||||
{
|
||||
// arrange
|
||||
|
||||
// act
|
||||
REGISTER_THREADAPI_GLOBAL_MOCK_HOOK();
|
||||
REGISTER_SRW_LOCK_GLOBAL_MOCK_HOOK();
|
||||
REGISTER_STRING_UTILS_GLOBAL_MOCK_HOOK();
|
||||
REGISTER_TIMER_GLOBAL_MOCK_HOOK();
|
||||
REGISTER_INTERLOCKED_HL_GLOBAL_MOCK_HOOK();
|
||||
|
||||
// assert
|
||||
// no explicit assert, if it builds it works
|
||||
}
|
||||
|
||||
END_TEST_SUITE(reals_win32_ut)
|
Загрузка…
Ссылка в новой задаче