Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
c227e4b2
Commit
c227e4b2
authored
Feb 26, 2016
by
Gautier Pelloux-Prayer
Browse files
tester: remove common, use bctoolbox instead
parent
16322b04
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
10 additions
and
1129 deletions
+10
-1129
CMakeLists.txt
CMakeLists.txt
+0
-14
cmake/FindCUnit.cmake
cmake/FindCUnit.cmake
+0
-58
mediastreamer2
mediastreamer2
+1
-1
tester/CMakeLists.txt
tester/CMakeLists.txt
+7
-9
tester/common/bc_completion
tester/common/bc_completion
+0
-115
tester/common/bc_tester_utils.c
tester/common/bc_tester_utils.c
+0
-731
tester/common/bc_tester_utils.h
tester/common/bc_tester_utils.h
+0
-199
tester/liblinphone_tester.c
tester/liblinphone_tester.c
+1
-1
tester/liblinphone_tester.h
tester/liblinphone_tester.h
+1
-1
No files found.
CMakeLists.txt
View file @
c227e4b2
...
...
@@ -106,20 +106,6 @@ else()
endif
()
find_package
(
XML2 REQUIRED
)
find_package
(
Zlib
)
if
(
ENABLE_UNIT_TESTS
)
find_package
(
CUnit
)
if
(
CUNIT_FOUND
)
cmake_push_check_state
(
RESET
)
list
(
APPEND CMAKE_REQUIRED_INCLUDES
${
CUNIT_INCLUDE_DIRS
}
)
list
(
APPEND CMAKE_REQUIRED_LIBRARIES
${
CUNIT_LIBRARIES
}
)
check_symbol_exists
(
"CU_get_suite"
"CUnit/CUnit.h"
HAVE_CU_GET_SUITE
)
check_symbol_exists
(
"CU_curses_run_tests"
"CUnit/CUnit.h"
HAVE_CU_CURSES
)
cmake_pop_check_state
()
else
()
message
(
WARNING
"Could not find the cunit library!"
)
set
(
ENABLE_UNIT_TESTS OFF CACHE BOOL
"Enable compilation of unit tests."
FORCE
)
endif
()
endif
()
if
(
ENABLE_TUNNEL
)
if
(
LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS
)
include
(
"
${
EP_tunnel_CONFIG_DIR
}
/TunnelConfig.cmake"
)
...
...
cmake/FindCUnit.cmake
deleted
100644 → 0
View file @
16322b04
############################################################################
# FindCUnit.txt
# Copyright (C) 2015 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
#
# - Find the CUnit include file and library
#
# CUNIT_FOUND - system has CUnit
# CUNIT_INCLUDE_DIRS - the CUnit include directory
# CUNIT_LIBRARIES - The libraries needed to use CUnit
include
(
CheckIncludeFile
)
include
(
CheckLibraryExists
)
set
(
_CUNIT_ROOT_PATHS
${
CMAKE_INSTALL_PREFIX
}
)
find_path
(
CUNIT_INCLUDE_DIRS
NAMES CUnit/CUnit.h
HINTS _CUNIT_ROOT_PATHS
PATH_SUFFIXES include
)
if
(
CUNIT_INCLUDE_DIRS
)
set
(
HAVE_CUNIT_CUNIT_H 1
)
endif
()
find_library
(
CUNIT_LIBRARIES
NAMES cunit
HINTS
${
_CUNIT_ROOT_PATHS
}
PATH_SUFFIXES bin lib
)
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
CUnit
DEFAULT_MSG
CUNIT_INCLUDE_DIRS CUNIT_LIBRARIES
)
mark_as_advanced
(
CUNIT_INCLUDE_DIRS CUNIT_LIBRARIES
)
mediastreamer2
@
ec7ca51d
Subproject commit
491ab7ecd0611841964c46e33e76f5d23f786265
Subproject commit
ec7ca51d8e96d38549e9331e3476c21ee43c65c4
tester/CMakeLists.txt
View file @
c227e4b2
...
...
@@ -21,7 +21,6 @@
############################################################################
set
(
SOURCE_FILES
common/bc_tester_utils.c
accountmanager.c
call_tester.c
complex_sip_call_tester.c
...
...
@@ -63,29 +62,28 @@ add_definitions(-DBC_CONFIG_FILE="config.h")
if
(
IOS
)
add_library
(
linphonetester STATIC
${
SOURCE_FILES
}
)
target_include_directories
(
linphonetester PUBLIC
${
CUNIT
_INCLUDE_DIRS
}
PRIVATE common
)
target_link_libraries
(
linphonetester linphone
${
CUNIT
_LIBRARIES
}
)
target_include_directories
(
linphonetester PUBLIC
${
BCTOOLBOX
_INCLUDE_DIRS
}
)
target_link_libraries
(
linphonetester linphone
${
BCTOOLBOX
_LIBRARIES
}
)
install
(
TARGETS linphonetester
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install
(
FILES
"liblinphone_tester.h"
"common/bc_tester_utils.h"
install
(
FILES
"liblinphone_tester.h"
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/linphone
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
elseif
(
CMAKE_SYSTEM_NAME STREQUAL
"WindowsStore"
)
add_library
(
linphone_tester_static STATIC
${
SOURCE_FILES
}
)
target_include_directories
(
linphone_tester_static PUBLIC
${
CUNIT
_INCLUDE_DIRS
}
PRIVATE common
)
target_link_libraries
(
linphone_tester_static linphone
${
CUNIT
_LIBRARIES
}
)
target_include_directories
(
linphone_tester_static PUBLIC
${
BCTOOLBOX
_INCLUDE_DIRS
}
)
target_link_libraries
(
linphone_tester_static linphone
${
BCTOOLBOX
_LIBRARIES
}
)
set
(
RUNTIME_COMPONENT_SOURCES
liblinphone_tester_windows.cpp
liblinphone_tester_windows.h
)
add_library
(
linphone_tester_runtime MODULE
${
RUNTIME_COMPONENT_SOURCES
}
)
target_include_directories
(
linphone_tester_runtime PRIVATE common
)
target_compile_options
(
linphone_tester_runtime PRIVATE
"/wd4996"
)
target_link_libraries
(
linphone_tester_runtime linphone_tester_static
)
set_target_properties
(
linphone_tester_runtime PROPERTIES VS_WINRT_COMPONENT TRUE
)
...
...
@@ -108,8 +106,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
else
()
add_executable
(
liblinphone_tester
${
SOURCE_FILES
}
)
set_target_properties
(
liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX
)
target_include_directories
(
liblinphone_tester PUBLIC
${
CUNIT
_INCLUDE_DIRS
}
PRIVATE common
)
target_link_libraries
(
liblinphone_tester linphone
${
CUNIT
_LIBRARIES
}
)
target_include_directories
(
liblinphone_tester PUBLIC
${
BCTOOLBOX
_INCLUDE_DIRS
}
)
target_link_libraries
(
liblinphone_tester linphone
${
BCTOOLBOX
_LIBRARIES
}
)
if
(
GTK2_FOUND
)
target_compile_definitions
(
liblinphone_tester PRIVATE HAVE_GTK
)
target_include_directories
(
liblinphone_tester PUBLIC
${
GTK2_INCLUDE_DIRS
}
)
...
...
tester/common/bc_completion
deleted
100644 → 0
View file @
16322b04
# Copyright (C) 2012 Belledonne Comunications, Grenoble, France
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Created by Gautier Pelloux-Prayer on 2014/10/24.
# This script adds auto-completion for liblinphone_tester binary for Bash and
# Zsh. To use it, just type: `source liblinphone_completion`, then for each
# supported exectuable (see end of file), you will get auto-completions.
# To use it permanently, source this file in your .rc file (.bashrc or .zshrc).
_liblinphone_complete() {
local completions command_requiring_argument prev_arg latest_arg available_tasks has_not_set_suite suite_name
if [ -n "$BASH_VERSION" ]; then
set -- "${COMP_WORDS[@]}" #convert them to arguments (eg $1,$#,$@,etc.)
elif [ -n "$ZSH_VERSION" ]; then
local args
read -cA args #read list of arguments user entered
set -- "${args[@]}" #convert them to arguments (eg $1,$#,$@,etc.)
fi
#skip program name
program=$1
shift
# if user required help, do not complete anything
if ! grep -q -- "--help" <<< "$@"; then
# retrieve the last argument
latest_arg=""
prev_arg=""
latest_is_empty=0
for arg in "$@"; do
if [ ! -z "$arg" ]; then
prev_arg="$latest_arg"
latest_arg="$arg"
else
latest_is_empty=1
fi
done
# get the tasks available, from --help
available_tasks="$($program 2>&1 --help | sed -nE "s/.*--([^ ]*).*/--\\1/p")"
# these commands expect an argument
command_requiring_argument="$($program 2>&1 --help | sed -nE "s/.*--(.*) <.*/--\\1/p")"
# remove all already provided tasks (it's useless to provide them twice)
if [[ ! -z "$@" ]]; then
current_tasks=$(echo $@ | grep -Eo -- "--([^ ])*" | tr '\n' '|' | sed 's/|/$|/g')--$
if [ ! -z "$current_tasks" ]; then
available_tasks=$(echo "$available_tasks" | grep -vE -- "(${current_tasks})")
fi
fi
# remove --test option if --suite is not provided yet!
has_not_set_suite=$(grep -q -- "--suite" <<< "$@"; echo $?)
if [ $has_not_set_suite = 1 ]; then
available_tasks=$(echo "$available_tasks" | grep -v -- --test)
fi
# if latest arg does not start with '--', it is a custom value
if [ $latest_is_empty = 0 ] && ! grep -q -- '^--' <<< "$latest_arg"; then
if [ "$prev_arg" = "--test" ] && [ $has_not_set_suite = 0 ]; then
suite_name=$(echo $@ | sed -nE 's/.*--suite ([^(--)]*) (--.*)$/\1/p' |sed "s@\\\\@@g")
completions="$($program --list-tests $suite_name)"
elif [ "$prev_arg" = "--suite" ] || [ "$prev_arg" = "--list-tests" ]; then
completions="$($program --list-suites)"
fi
elif [ "$latest_arg" = "--test" ]; then
# list available tests if --suite was provided
if [ $has_not_set_suite = 0 ]; then
suite_name=$(echo $@ | sed -nE 's/.*--suite ([^(--)]*) (--.*)/\1/p' |sed "s@\\\\@@g")
completions="$($program --list-tests $suite_name)"
fi
elif [ "$latest_arg" = "--suite" ] || [ "$latest_arg" = "--list-tests" ]; then
completions="$($program --list-suites)"
# we are waiting for a custom value, so do not hint anything
elif [[ ! -z "$latest_arg" ]] && grep -q -- "^$latest_arg$" <<< "$command_requiring_argument"; then
completions=""
else
completions="$available_tasks"
fi
fi
if [ ! -z "$completions" ]; then
if [ -n "$BASH_VERSION" ]; then
IFS=$'\n' #if that even necessary?
COMPREPLY=($(compgen -W "${completions}" -- ${COMP_WORDS[COMP_CWORD]}))
elif [ -n "$ZSH_VERSION" ]; then
reply=( "${(ps:\n:)completions}" )
fi
fi
}
for tester in liblinphone_tester mediastreamer2_tester belle_sip_tester pcap_playback \
bench mediastream msaudiocmp mtudiscover videodisplay linphone lpc2xml_test \
lp-gen-wrappers xml2lpc_test; do
if [ -n "$BASH_VERSION" ]; then
complete -F _liblinphone_complete $tester
elif [ -n "$ZSH_VERSION" ]; then
compctl -K _liblinphone_complete $tester
else
echo "Your shell might be not supported! Only bash and zsh tested."
fi
done
tester/common/bc_tester_utils.c
deleted
100644 → 0
View file @
16322b04
This diff is collapsed.
Click to expand it.
tester/common/bc_tester_utils.h
deleted
100644 → 0
View file @
16322b04
/*
tester - liblinphone test suite
Copyright (C) 2013 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TESTER_UTILS_H
#define TESTER_UTILS_H
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#ifdef _WIN32
#ifndef snprintf
#define snprintf _snprintf
#define strcasecmp _stricmp
#endif
#ifndef strdup
#define strdup _strdup
#endif
#endif
extern
int
bc_printf_verbosity_info
;
extern
int
bc_printf_verbosity_error
;
typedef
void
(
*
test_function_t
)(
void
);
/** Function used in all suites - it is invoked before all and each tests and also after each and all tests
* @return 0 means success, otherwise it's an error
**/
typedef
int
(
*
pre_post_function_t
)(
void
);
// typedef int (*test_suite_function_t)(const char *name);
typedef
struct
{
const
char
*
name
;
test_function_t
func
;
const
char
*
tags
[
2
];
}
test_t
;
#define TEST_NO_TAG(name, func) \
{ name, func, { NULL, NULL } }
#define TEST_ONE_TAG(name, func, tag) \
{ name, func, { tag, NULL } }
#define TEST_TWO_TAGS(name, func, tag1, tag2) \
{ name, func, { tag1, tag2 } }
typedef
struct
{
const
char
*
name
;
/*suite name*/
pre_post_function_t
before_all
;
/*function invoked before running the suite. If not returning 0, suite is not launched. */
pre_post_function_t
after_all
;
/*function invoked at the end of the suite, even if some tests failed. */
test_function_t
before_each
;
/*function invoked before each test within this suite. */
pre_post_function_t
after_each
;
/*function invoked after each test within this suite, even if it failed. */
int
nb_tests
;
/* number of tests */
test_t
*
tests
;
/* tests within this suite */
}
test_suite_t
;
#ifdef __cplusplus
extern
"C"
{
#endif
#define CHECK_ARG(argument, index, argc) \
if(index >= argc) { \
fprintf(stderr, "Missing argument for \"%s\"\n", argument); \
return -1; \
} \
void
bc_tester_init
(
void
(
*
ftester_printf
)(
int
level
,
const
char
*
fmt
,
va_list
args
)
,
int
verbosity_info
,
int
verbosity_error
);
void
bc_tester_helper
(
const
char
*
name
,
const
char
*
additionnal_helper
);
int
bc_tester_parse_args
(
int
argc
,
char
**
argv
,
int
argid
);
int
bc_tester_start
(
const
char
*
prog_name
);
void
bc_tester_add_suite
(
test_suite_t
*
suite
);
void
bc_tester_uninit
(
void
);
void
bc_tester_printf
(
int
level
,
const
char
*
fmt
,
...);
const
char
*
bc_tester_get_resource_dir_prefix
(
void
);
void
bc_tester_set_resource_dir_prefix
(
const
char
*
name
);
const
char
*
bc_tester_get_writable_dir_prefix
(
void
);
void
bc_tester_set_writable_dir_prefix
(
const
char
*
name
);
int
bc_tester_nb_suites
(
void
);
int
bc_tester_nb_tests
(
const
char
*
name
);
void
bc_tester_list_suites
(
void
);
void
bc_tester_list_tests
(
const
char
*
suite_name
);
const
char
*
bc_tester_suite_name
(
int
suite_index
);
const
char
*
bc_tester_test_name
(
const
char
*
suite_name
,
int
test_index
);
int
bc_tester_run_suite
(
test_suite_t
*
suite
,
const
char
*
tag_name
);
int
bc_tester_run_tests
(
const
char
*
suite_name
,
const
char
*
test_name
,
const
char
*
tag_name
);
int
bc_tester_suite_index
(
const
char
*
suite_name
);
const
char
*
bc_tester_current_suite_name
(
void
);
const
char
*
bc_tester_current_test_name
(
void
);
const
char
**
bc_tester_current_test_tags
(
void
);
char
*
bc_sprintfva
(
const
char
*
format
,
va_list
args
);
char
*
bc_sprintf
(
const
char
*
format
,
...);
void
bc_free
(
void
*
ptr
);
/**
* Get full path to the given resource
*
* @param name relative resource path
* @return path to the resource. Must be freed by caller.
*/
char
*
bc_tester_res
(
const
char
*
name
);
/**
* Get full path to the given writable_file
*
* @param name relative writable file path
* @return path to the writable file. Must be freed by caller.
*/
char
*
bc_tester_file
(
const
char
*
name
);
/*Redefine the CU_... macros WITHOUT final ';' semicolon, to allow IF conditions and smarter error message */
extern
int
CU_assertImplementation
(
int
bValue
,
unsigned
int
uiLine
,
const
char
*
strCondition
,
const
char
*
strFile
,
const
char
*
strFunction
,
int
bFatal
);
#ifdef _WIN32
#define BC_INLINE __inline
#else
#define BC_INLINE inline
#endif
static
BC_INLINE
int
_BC_ASSERT
(
const
char
*
file
,
int
line
,
int
predicate
,
const
char
*
format
,
int
fatal
)
{
if
(
!
predicate
)
bc_tester_printf
(
bc_printf_verbosity_info
,
format
,
NULL
);
return
CU_assertImplementation
(
predicate
,
line
,
format
,
file
,
""
,
fatal
);
}
#define _BC_ASSERT_PRED(name, pred, actual, expected, type, fatal, ...) \
do { \
char format[4096] = {0}; \
type cactual = (actual); \
type cexpected = (expected); \
snprintf(format, 4096, name "(" #actual ", " #expected ") - " __VA_ARGS__); \
_BC_ASSERT(__FILE__, __LINE__, pred, format, fatal); \
} while (0)
#define BC_PASS(msg) _BC_ASSERT(__FILE__, __LINE__, TRUE, "BC_PASS(" #msg ").", FALSE)
#define BC_FAIL(msg) _BC_ASSERT(__FILE__, __LINE__, FALSE, "BC_FAIL(" #msg ").", FALSE)
#define BC_ASSERT(value) _BC_ASSERT(__FILE__, __LINE__, (value), #value, FALSE)
#define BC_ASSERT_FATAL(value) _BC_ASSERT(__FILE__, __LINE__, (value), #value, TRUE)
#define BC_TEST(value) _BC_ASSERT(__FILE__, __LINE__, (value), #value, FALSE)
#define BC_TEST_FATAL(value) _BC_ASSERT(__FILE__, __LINE__, (value), #value, TRUE)
#define BC_ASSERT_TRUE(value) _BC_ASSERT(__FILE__, __LINE__, (value), ("BC_ASSERT_TRUE(" #value ")"), FALSE)
#define BC_ASSERT_TRUE_FATAL(value) _BC_ASSERT(__FILE__, __LINE__, (value), ("BC_ASSERT_TRUE_FATAL(" #value ")"), TRUE)
#define BC_ASSERT_FALSE(value) _BC_ASSERT(__FILE__, __LINE__, !(value), ("BC_ASSERT_FALSE(" #value ")"), FALSE)
#define BC_ASSERT_FALSE_FATAL(value) _BC_ASSERT(__FILE__, __LINE__, !(value), ("BC_ASSERT_FALSE_FATAL(" #value ")"), TRUE)
#define BC_ASSERT_EQUAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_EQUAL", ((cactual) == (cexpected)), actual, expected, type, FALSE, "Expected " type_format " but was " type_format ".", cexpected, cactual)
#define BC_ASSERT_EQUAL_FATAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_EQUAL_FATAL", ((cactual) == (cexpected)), actual, expected, type, TRUE, "Expected " type_format " but was " type_format ".", cexpected, cactual)
#define BC_ASSERT_NOT_EQUAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_NOT_EQUAL", ((cactual) != (cexpected)), actual, expected, type, FALSE, "Expected NOT " type_format " but it was.", cexpected)
#define BC_ASSERT_NOT_EQUAL_FATAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_NOT_EQUAL_FATAL", ((cactual) != (cexpected)), actual, expected, type, TRUE, "Expected NOT " type_format " but it was.", cexpected)
#define BC_ASSERT_PTR_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_EQUAL", ((cactual) == (cexpected)), (const void*)(actual), (const void*)(expected), const void*, FALSE, "Expected %p but was %p.", cexpected, cactual)
#define BC_ASSERT_PTR_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_EQUAL_FATAL", ((cactual) == (cexpected)), (const void*)(actual), (const void*)(expected), const void*, TRUE, "Expected %p but was %p.", cexpected, cactual)
#define BC_ASSERT_PTR_NOT_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_EQUAL", ((cactual) != (cexpected)), (const void*)(actual), (const void*)(expected), const void*, FALSE, "Expected NOT %p but it was.", cexpected)
#define BC_ASSERT_PTR_NOT_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_EQUAL_FATAL", ((cactual) != (cexpected)), (const void*)(actual), (const void*)(expected), const void*, TRUE, "Expected NOT %p but it was.", cexpected)
#define BC_ASSERT_PTR_NULL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NULL", ((cactual) == (cexpected)), (const void*)(value), NULL, const void*, FALSE, "Expected NULL but was %p.", cactual)
#define BC_ASSERT_PTR_NULL_FATAL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NULL_FATAL", ((cactual) == (cexpected)), (const void*)(value), NULL, const void*, TRUE, "Expected NULL but was %p.", cactual)
#define BC_ASSERT_PTR_NOT_NULL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_NULL", ((cactual) != (cexpected)), (const void*)(value), NULL, const void*, FALSE, "Expected NOT NULL but it was.")
#define BC_ASSERT_PTR_NOT_NULL_FATAL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_NULL_FATAL", ((cactual) != (cexpected)), (const void*)(value), NULL, const void*, TRUE, "Expected NOT NULL but it was.")
#define BC_ASSERT_STRING_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_EQUAL", !(strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, FALSE, "Expected %s but was %s.", cexpected, cactual)
#define BC_ASSERT_STRING_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_EQUAL_FATAL", !(strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, TRUE, "Expected %s but was %s.", cexpected, cactual)
#define BC_ASSERT_STRING_NOT_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_NOT_EQUAL", (strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, FALSE, "Expected NOT %s but it was.", cexpected)
#define BC_ASSERT_STRING_NOT_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_NOT_EQUAL_FATAL", (strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, TRUE, "Expected NOT %s but it was.", cexpected)
#define BC_ASSERT_NSTRING_EQUAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_EQUAL", !(strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, FALSE, "Expected %*s but was %*s.", (int)(count), cexpected, (int)(count), cactual)
#define BC_ASSERT_NSTRING_EQUAL_FATAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_EQUAL_FATAL", !(strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, TRUE, "Expected %*s but was %*s.", (int)count, cexpected, (int)count, cactual)
#define BC_ASSERT_NSTRING_NOT_EQUAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_NOT_EQUAL", (strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, FALSE, "Expected %*s but it was.", (int)count, cexpected)
#define BC_ASSERT_NSTRING_NOT_EQUAL_FATAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_NOT_EQUAL_FATAL", (strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, TRUE, "Expected %*s but it was.", (int)count, cexpected)
#define BC_ASSERT_DOUBLE_EQUAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_EQUAL", ((fabs((double)(cactual) - (cexpected)) <= fabs((double)(granularity)))), actual, expected, double, FALSE, "Expected %f but was %f.", cexpected, cactual)
#define BC_ASSERT_DOUBLE_EQUAL_FATAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_EQUAL_FATAL", ((fabs((double)(cactual) - (cexpected)) <= fabs((double)(granularity)))), actual, expected, double, TRUE, "Expected %f but was %f.", cexpected, cactual)
#define BC_ASSERT_DOUBLE_NOT_EQUAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_NOT_EQUAL", ((fabs((double)(cactual) - (cexpected)) > fabs((double)(granularity)))), actual, expected, double, FALSE, "Expected %f but was %f.", cexpected, cactual)
#define BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL", ((fabs((double)(cactual) - (cexpected)) > fabs((double)(granularity)))), actual, expected, double, TRUE, "Expected %f but was %f.", cexpected, cactual)
/*Custom defines*/
#define BC_ASSERT_GREATER(actual, lower, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_GREATER", ((cactual) >= (cexpected)), actual, lower, type, FALSE, "Expected at least " type_format " but was " type_format ".", cexpected, cactual)
#define BC_ASSERT_LOWER(actual, lower, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_LOWER", ((cactual) <= (cexpected)), actual, lower, type, FALSE, "Expected at most " type_format " but was " type_format ".", cexpected, cactual)
#ifdef __cplusplus
}
#endif
#endif
tester/liblinphone_tester.c
View file @
c227e4b2
...
...
@@ -163,7 +163,7 @@ void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, v
}
if
(
ftester_printf
==
NULL
)
ftester_printf
=
log_handler
;
bc_tester_init
(
ftester_printf
,
ORTP_MESSAGE
,
ORTP_ERROR
);
bc_tester_init
(
ftester_printf
,
ORTP_MESSAGE
,
ORTP_ERROR
,
"rcfiles"
);
liblinphone_tester_add_suites
();
}
...
...
tester/liblinphone_tester.h
View file @
c227e4b2
...
...
@@ -22,7 +22,7 @@
#include
"
bc
_tester_utils
.h
"
#include
<
bc
toolbox/tester
.h
>
#include "linphonecore.h"
#include <mediastreamer2/msutils.h>
#ifdef HAVE_CONFIG_H
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment