From c202100fe408499e8a18a5878af0fcfc74bfc635 Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Tue, 4 Dec 2012 12:28:10 -0800 Subject: [PATCH] Enable unit tests to build with MSVC Change-Id: Ie80597221bee494679ae2ba50cca22dea2609cba --- libs.mk | 2 ++ test/idct8x8_test.cc | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/libs.mk b/libs.mk index 58151a66d..97892cc00 100644 --- a/libs.mk +++ b/libs.mk @@ -425,6 +425,7 @@ gtest.vcproj: $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc --proj-guid=EC00E1EC-AF68-4D92-A255-181690D1C9B1 \ --ver=$(CONFIG_VS_VERSION) \ --src-path-bare="$(SRC_PATH_BARE)" \ + -D_VARIADIC_MAX=10 \ --out=gtest.vcproj $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc \ -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" -I"$(SRC_PATH_BARE)/third_party/googletest/src" @@ -436,6 +437,7 @@ test_libvpx.vcproj: $(LIBVPX_TEST_SRCS) --exe \ --target=$(TOOLCHAIN) \ --name=test_libvpx \ + -D_VARIADIC_MAX=10 \ --proj-guid=CD837F5F-52D8-4314-A370-895D614166A7 \ --ver=$(CONFIG_VS_VERSION) \ $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \ diff --git a/test/idct8x8_test.cc b/test/idct8x8_test.cc index 7cf7aa0ea..ab71e8566 100644 --- a/test/idct8x8_test.cc +++ b/test/idct8x8_test.cc @@ -25,6 +25,15 @@ using libvpx_test::ACMRandom; namespace { +#ifdef _MSC_VER +static int round(double x) { + if(x < 0) + return (int)ceil(x - 0.5); + else + return (int)floor(x + 0.5); +} +#endif + void reference_dct_1d(double input[8], double output[8]) { const double kPi = 3.141592653589793238462643383279502884; const double kInvSqrt2 = 0.707106781186547524400844362104; -- 2.40.0