#******************************************************************
#
# Copyright 2016 Microsoft
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

import os.path

######################################################################
# Build the gtest framework
######################################################################
gtest_env = SConscript('#extlibs/gtest/SConscript')

c_common_windows_test_env = gtest_env.Clone()

######################################################################
# Build flags
######################################################################
c_common_windows_test_env.PrependUnique(CPPPATH = ['../include'])

c_common_windows_test_env.AppendUnique(LIBPATH = [os.path.join(c_common_windows_test_env.get('BUILD_DIR'), 'resource', 'c_common')])
c_common_windows_test_env.PrependUnique(LIBS = ['win_helper'])

if c_common_windows_test_env.get('LOGGING'):
    c_common_windows_test_env.AppendUnique(CPPDEFINES = ['TB_LOG'])

######################################################################
# Source files and Targets
######################################################################
c_common_windows_tests = c_common_windows_test_env.Program('c_common_windows_tests', ['snprintf_test.cpp'])

Alias("test", [c_common_windows_tests])

c_common_windows_test_env.AppendTarget('test')

from tools.scons.RunTest import *
run_test(c_common_windows_test_env,
         'resource_c_common_windows_test.memcheck',
         'resource/c_common/windows/test/c_common_windows_tests')
