Functions: move tests closer to code

This commit is contained in:
Jacques Lucke 2020-07-26 12:19:11 +02:00
parent 13abacaaf3
commit 6cecdf2ade
10 changed files with 37 additions and 62 deletions

View File

@ -57,3 +57,20 @@ set(LIB
)
blender_add_lib(bf_functions "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
if(WITH_GTESTS)
set(TEST_SRC
tests/FN_array_spans_test.cc
tests/FN_attributes_ref_test.cc
tests/FN_cpp_type_test.cc
tests/FN_generic_vector_array_test.cc
tests/FN_multi_function_network_test.cc
tests/FN_multi_function_test.cc
tests/FN_spans_test.cc
)
set (TEST_LIB
bf_functions
)
include(GTestTesting)
blender_add_test_lib(bf_functions_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}")
endif()

View File

@ -7,7 +7,7 @@
#include "BLI_array.hh"
namespace blender::fn {
namespace blender::fn::tests {
TEST(virtual_array_span, EmptyConstructor)
{
@ -129,4 +129,4 @@ TEST(generic_virtual_array_span, IsSingleArray2)
EXPECT_FALSE(converted.is_single_array());
}
} // namespace blender::fn
} // namespace blender::fn::tests

View File

@ -5,7 +5,7 @@
#include "testing/testing.h"
namespace blender::fn {
namespace blender::fn::tests {
TEST(attributes_info, BuildEmpty)
{
@ -94,4 +94,4 @@ TEST(mutable_attributes_ref, ComplexTest)
EXPECT_EQ(ids[2], 100);
}
} // namespace blender::fn
} // namespace blender::fn::tests

View File

@ -4,7 +4,7 @@
#include "FN_cpp_type.hh"
namespace blender::fn {
namespace blender::fn::tests {
static const int default_constructed_value = 1;
static const int copy_constructed_value = 2;
@ -62,7 +62,7 @@ struct TestType {
return stream;
}
friend bool operator==(const TestType &a, const TestType &b)
friend bool operator==(const TestType &UNUSED(a), const TestType &UNUSED(b))
{
return false;
}
@ -73,7 +73,11 @@ struct TestType {
}
};
MAKE_CPP_TYPE(TestType, TestType)
} // namespace blender::fn::tests
MAKE_CPP_TYPE(TestType, blender::fn::tests::TestType)
namespace blender::fn::tests {
const CPPType &CPPType_TestType = CPPType::get<TestType>();
@ -318,4 +322,4 @@ TEST(cpp_type, DebugPrint)
EXPECT_EQ(text, "42");
}
} // namespace blender::fn
} // namespace blender::fn::tests

View File

@ -4,7 +4,7 @@
#include "testing/testing.h"
namespace blender::fn {
namespace blender::fn::tests {
TEST(generic_vector_array, Constructor)
{
@ -98,4 +98,4 @@ TEST(generic_vector_array, Extend)
EXPECT_EQ(ref[0][0], 3);
}
} // namespace blender::fn
} // namespace blender::fn::tests

View File

@ -6,7 +6,7 @@
#include "FN_multi_function_network.hh"
#include "FN_multi_function_network_evaluation.hh"
namespace blender::fn {
namespace blender::fn::tests {
TEST(multi_function_network, Test1)
{
@ -250,4 +250,4 @@ TEST(multi_function_network, Test2)
}
}
} // namespace blender::fn
} // namespace blender::fn::tests

View File

@ -5,7 +5,7 @@
#include "FN_multi_function.hh"
#include "FN_multi_function_builder.hh"
namespace blender::fn {
namespace blender::fn::tests {
class AddFunction : public MultiFunction {
public:
@ -382,4 +382,4 @@ TEST(multi_function, CustomMF_Convert)
EXPECT_EQ(outputs[2], 9);
}
} // namespace blender::fn
} // namespace blender::fn::tests

View File

@ -4,7 +4,7 @@
#include "FN_spans.hh"
namespace blender::fn {
namespace blender::fn::tests {
TEST(generic_span, TypeConstructor)
{
@ -211,4 +211,4 @@ TEST(generic_virtual_span, SingleConstructor)
EXPECT_EQ(converted[2], 5);
}
} // namespace blender::fn
} // namespace blender::fn::tests

View File

@ -12,7 +12,6 @@ if(WITH_GTESTS)
add_subdirectory(blenloader)
add_subdirectory(guardedalloc)
add_subdirectory(bmesh)
add_subdirectory(functions)
if(WITH_CODEC_FFMPEG)
add_subdirectory(ffmpeg)
endif()

View File

@ -1,45 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
set(INC
.
..
../../../source/blender/blenlib
../../../source/blender/functions
../../../source/blender/makesdna
../../../intern/guardedalloc
)
setup_libdirs()
include_directories(${INC})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
if(WITH_BUILDINFO)
set(BUILDINFO buildinfoobj)
endif()
BLENDER_TEST(FN_array_spans "bf_blenlib;bf_functions;${BUILDINFO}")
BLENDER_TEST(FN_attributes_ref "bf_blenlib;bf_functions;${BUILDINFO}")
BLENDER_TEST(FN_cpp_type "bf_blenlib;bf_functions;${BUILDINFO}")
BLENDER_TEST(FN_generic_vector_array "bf_blenlib;bf_functions;${BUILDINFO}")
BLENDER_TEST(FN_multi_function "bf_blenlib;bf_functions;${BUILDINFO}")
BLENDER_TEST(FN_multi_function_network "bf_blenlib;bf_functions;${BUILDINFO}")
BLENDER_TEST(FN_spans "bf_blenlib;bf_functions;${BUILDINFO}")