Updated ozz-animation to version 0.14.1 @35b2efd4
This commit is contained in:
@@ -3,6 +3,7 @@ target_include_directories(test_intrusive_list
|
||||
PUBLIC "${PROJECT_SOURCE_DIR}/include")
|
||||
target_link_libraries(test_intrusive_list
|
||||
gtest)
|
||||
target_copy_shared_libraries(test_intrusive_list)
|
||||
add_test(NAME test_intrusive_list COMMAND test_intrusive_list)
|
||||
set_target_properties(test_intrusive_list PROPERTIES FOLDER "ozz/tests/base")
|
||||
|
||||
@@ -10,6 +11,7 @@ add_executable(test_std_containers std_containers_tests.cc)
|
||||
target_link_libraries(test_std_containers
|
||||
ozz_base
|
||||
gtest)
|
||||
target_copy_shared_libraries(test_std_containers)
|
||||
add_test(NAME test_std_containers COMMAND test_std_containers)
|
||||
set_target_properties(test_std_containers PROPERTIES FOLDER "ozz/tests/base")
|
||||
|
||||
@@ -18,5 +20,6 @@ add_executable(test_std_containers_archive
|
||||
target_link_libraries(test_std_containers_archive
|
||||
ozz_base
|
||||
gtest)
|
||||
target_copy_shared_libraries(test_std_containers_archive)
|
||||
add_test(NAME test_std_containers_archive COMMAND test_std_containers_archive)
|
||||
set_target_properties(test_std_containers_archive PROPERTIES FOLDER "ozz/tests/base")
|
||||
|
||||
+46
-5
@@ -25,13 +25,12 @@
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#include "ozz/base/containers/string_archive.h"
|
||||
#include "ozz/base/containers/vector_archive.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "ozz/base/containers/array_archive.h"
|
||||
#include "ozz/base/containers/string_archive.h"
|
||||
#include "ozz/base/containers/vector_archive.h"
|
||||
#include "ozz/base/io/archive.h"
|
||||
|
||||
TEST(string, Archive) {
|
||||
@@ -123,7 +122,7 @@ TEST(Vector, Archive) {
|
||||
ozz::vector<int> small_i;
|
||||
i >> small_i;
|
||||
EXPECT_EQ(small_o.size(), small_i.size());
|
||||
for (size_t j = 0; j < empty_i.size(); ++j) {
|
||||
for (size_t j = 0; j < small_i.size(); ++j) {
|
||||
EXPECT_EQ(small_o[j], small_i[j]);
|
||||
}
|
||||
|
||||
@@ -143,3 +142,45 @@ TEST(Vector, Archive) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Array, Archive) {
|
||||
for (int e = 0; e < 2; ++e) {
|
||||
ozz::Endianness endianess = e == 0 ? ozz::kBigEndian : ozz::kLittleEndian;
|
||||
|
||||
ozz::io::MemoryStream stream;
|
||||
ASSERT_TRUE(stream.opened());
|
||||
|
||||
// Writes.
|
||||
ozz::io::OArchive o(&stream, endianess);
|
||||
ozz::array<int, 0> empty_o;
|
||||
o << empty_o;
|
||||
|
||||
ozz::array<int, 5> array_o{{0, 1, 2, 3, 4}};
|
||||
o << array_o;
|
||||
|
||||
// Rewrite for the Vector reuse test.
|
||||
ozz::array<int, 5> reuse_o{{5, 6, 7, 8, 9}};
|
||||
o << reuse_o;
|
||||
|
||||
// Reads.
|
||||
stream.Seek(0, ozz::io::Stream::kSet);
|
||||
ozz::io::IArchive i(&stream);
|
||||
|
||||
ozz::array<int, 0> empty_i;
|
||||
i >> empty_i;
|
||||
EXPECT_EQ(empty_i.size(), 0u);
|
||||
|
||||
ozz::array<int, 5> array_i;
|
||||
i >> array_i;
|
||||
EXPECT_EQ(array_o.size(), array_i.size());
|
||||
for (size_t j = 0; j < array_i.size(); ++j) {
|
||||
EXPECT_EQ(array_o[j], array_i[j]);
|
||||
}
|
||||
|
||||
i >> array_i;
|
||||
EXPECT_EQ(reuse_o.size(), array_i.size());
|
||||
for (size_t j = 0; j < array_i.size(); ++j) {
|
||||
EXPECT_EQ(reuse_o[j], array_i[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "ozz/base/containers/array.h"
|
||||
#include "ozz/base/containers/deque.h"
|
||||
#include "ozz/base/containers/list.h"
|
||||
#include "ozz/base/containers/map.h"
|
||||
@@ -39,6 +40,35 @@
|
||||
#include "ozz/base/gtest_helper.h"
|
||||
#include "ozz/base/span.h"
|
||||
|
||||
TEST(Allocator, Containers) {
|
||||
ozz::StdAllocator<int> int_allocator;
|
||||
int_allocator.deallocate(int_allocator.allocate(46), 46);
|
||||
ozz::StdAllocator<float> other_allocator(int_allocator);
|
||||
|
||||
class Object {
|
||||
public:
|
||||
Object(int& _counter) : counter_(_counter) { ++counter_; }
|
||||
~Object() { --counter_; }
|
||||
|
||||
private:
|
||||
int& counter_;
|
||||
};
|
||||
|
||||
int counter = 0;
|
||||
ozz::StdAllocator<Object> ObjectAllocator;
|
||||
Object* pointer = ObjectAllocator.allocate(1);
|
||||
int_allocator.construct(pointer, counter);
|
||||
EXPECT_EQ(counter, 1);
|
||||
|
||||
int_allocator.destroy(pointer);
|
||||
EXPECT_EQ(counter, 0);
|
||||
|
||||
ObjectAllocator.deallocate(pointer, 1);
|
||||
|
||||
EXPECT_TRUE(int_allocator == other_allocator);
|
||||
EXPECT_FALSE(int_allocator != other_allocator);
|
||||
}
|
||||
|
||||
TEST(Vector, Containers) {
|
||||
typedef ozz::vector<int> Container;
|
||||
Container container;
|
||||
@@ -54,6 +84,18 @@ TEST(Vector, Containers) {
|
||||
Container container2 = std::move(container);
|
||||
}
|
||||
|
||||
TEST(Array, Containers) {
|
||||
typedef ozz::array<int, 4> Container;
|
||||
Container container{{0, 1, 2, 3}};
|
||||
EXPECT_EQ(container[0], 0);
|
||||
EXPECT_EQ(container[1], 1);
|
||||
EXPECT_EQ(container[2], 2);
|
||||
EXPECT_EQ(container[3], 3);
|
||||
|
||||
Container container2 = std::move(container);
|
||||
(void)container2;
|
||||
}
|
||||
|
||||
TEST(VectorExtensions, Containers) {
|
||||
typedef ozz::vector<int> Container;
|
||||
Container container;
|
||||
|
||||
Reference in New Issue
Block a user