mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-28 07:45:40 +00:00
update assimp to 5.2.5 Bugfix-Release
This commit is contained in:
parent
360edf18a1
commit
c3f53b99ea
886 changed files with 7946 additions and 524449 deletions
|
|
@ -27,6 +27,8 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
// This provides interface PrimeTable that determines whether a number is a
|
||||
// prime and determines a next prime number. This interface is used
|
||||
// in Google Test samples demonstrating use of parameterized tests.
|
||||
|
|
@ -55,7 +57,7 @@ class OnTheFlyPrimeTable : public PrimeTable {
|
|||
bool IsPrime(int n) const override {
|
||||
if (n <= 1) return false;
|
||||
|
||||
for (int i = 2; i * i <= n; i++) {
|
||||
for (int i = 2; i*i <= n; i++) {
|
||||
// n is divisible by an integer other than 1 and itself.
|
||||
if ((n % i) == 0) return false;
|
||||
}
|
||||
|
|
@ -102,13 +104,13 @@ class PreCalculatedPrimeTable : public PrimeTable {
|
|||
|
||||
// Checks every candidate for prime number (we know that 2 is the only even
|
||||
// prime).
|
||||
for (int i = 2; i * i <= max; i += i % 2 + 1) {
|
||||
for (int i = 2; i*i <= max; i += i%2+1) {
|
||||
if (!is_prime_[i]) continue;
|
||||
|
||||
// Marks all multiples of i (except i itself) as non-prime.
|
||||
// We are starting here from i-th multiplier, because all smaller
|
||||
// complex numbers were already marked.
|
||||
for (int j = i * i; j <= max; j += i) {
|
||||
for (int j = i*i; j <= max; j += i) {
|
||||
is_prime_[j] = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ bool IsPrime(int n) {
|
|||
// Now, we have that n is odd and n >= 3.
|
||||
|
||||
// Try to divide n by every odd number i, starting from 3
|
||||
for (int i = 3;; i += 2) {
|
||||
for (int i = 3; ; i += 2) {
|
||||
// We only have to try i up to the square root of n
|
||||
if (i > n / i) break;
|
||||
if (i > n/i) break;
|
||||
|
||||
// Now, we have i <= n/i < n.
|
||||
// If n is divisible by i, n is not prime.
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
// This sample shows how to use Google Test listener API to implement
|
||||
// a primitive leak checker.
|
||||
|
||||
|
|
@ -103,15 +104,14 @@ TEST(ListenersTest, LeaksWater) {
|
|||
}
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int main(int argc, char **argv) {
|
||||
InitGoogleTest(&argc, argv);
|
||||
|
||||
bool check_for_leaks = false;
|
||||
if (argc > 1 && strcmp(argv[1], "--check_for_leaks") == 0)
|
||||
if (argc > 1 && strcmp(argv[1], "--check_for_leaks") == 0 )
|
||||
check_for_leaks = true;
|
||||
else
|
||||
printf("%s\n",
|
||||
"Run this program with --check_for_leaks to enable "
|
||||
printf("%s\n", "Run this program with --check_for_leaks to enable "
|
||||
"custom leak checking in the tests.");
|
||||
|
||||
// If we are given the --check_for_leaks command line flag, installs the
|
||||
|
|
|
|||
|
|
@ -34,15 +34,14 @@
|
|||
//
|
||||
// Writing a unit test using Google C++ testing framework is easy as 1-2-3:
|
||||
|
||||
|
||||
// Step 1. Include necessary header files such that the stuff your
|
||||
// test logic needs is declared.
|
||||
//
|
||||
// Don't forget gtest.h, which declares the testing framework.
|
||||
|
||||
#include "sample1.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include "sample1.h"
|
||||
#include "gtest/gtest.h"
|
||||
namespace {
|
||||
|
||||
|
|
@ -70,6 +69,7 @@ namespace {
|
|||
//
|
||||
// </TechnicalDetails>
|
||||
|
||||
|
||||
// Tests Factorial().
|
||||
|
||||
// Tests factorial of negative numbers.
|
||||
|
|
@ -97,7 +97,9 @@ TEST(FactorialTest, Negative) {
|
|||
}
|
||||
|
||||
// Tests factorial of 0.
|
||||
TEST(FactorialTest, Zero) { EXPECT_EQ(1, Factorial(0)); }
|
||||
TEST(FactorialTest, Zero) {
|
||||
EXPECT_EQ(1, Factorial(0));
|
||||
}
|
||||
|
||||
// Tests factorial of positive numbers.
|
||||
TEST(FactorialTest, Positive) {
|
||||
|
|
@ -107,6 +109,7 @@ TEST(FactorialTest, Positive) {
|
|||
EXPECT_EQ(40320, Factorial(8));
|
||||
}
|
||||
|
||||
|
||||
// Tests IsPrime()
|
||||
|
||||
// Tests negative input.
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ const char* MyString::CloneCString(const char* a_c_string) {
|
|||
if (a_c_string == nullptr) return nullptr;
|
||||
|
||||
const size_t len = strlen(a_c_string);
|
||||
char* const clone = new char[len + 1];
|
||||
char* const clone = new char[ len + 1 ];
|
||||
memcpy(clone, a_c_string, len + 1);
|
||||
|
||||
return clone;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
// A simple string class.
|
||||
class MyString {
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
// needed.
|
||||
|
||||
#include "sample2.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
namespace {
|
||||
// In this example, we test the MyString class (a simple string).
|
||||
|
|
@ -78,7 +77,8 @@ const char kHelloString[] = "Hello, world!";
|
|||
TEST(MyString, ConstructorFromCString) {
|
||||
const MyString s(kHelloString);
|
||||
EXPECT_EQ(0, strcmp(s.c_string(), kHelloString));
|
||||
EXPECT_EQ(sizeof(kHelloString) / sizeof(kHelloString[0]) - 1, s.Length());
|
||||
EXPECT_EQ(sizeof(kHelloString)/sizeof(kHelloString[0]) - 1,
|
||||
s.Length());
|
||||
}
|
||||
|
||||
// Tests the copy c'tor.
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
// Queue is a simple queue implemented as a singled-linked list.
|
||||
//
|
||||
// The element type must support copy constructor.
|
||||
|
|
@ -61,7 +62,7 @@ class QueueNode {
|
|||
: element_(an_element), next_(nullptr) {}
|
||||
|
||||
// We disable the default assignment operator and copy c'tor.
|
||||
const QueueNode& operator=(const QueueNode&);
|
||||
const QueueNode& operator = (const QueueNode&);
|
||||
QueueNode(const QueueNode&);
|
||||
|
||||
E element_;
|
||||
|
|
@ -83,7 +84,7 @@ class Queue {
|
|||
// 1. Deletes every node.
|
||||
QueueNode<E>* node = head_;
|
||||
QueueNode<E>* next = node->next();
|
||||
for (;;) {
|
||||
for (; ;) {
|
||||
delete node;
|
||||
node = next;
|
||||
if (node == nullptr) break;
|
||||
|
|
@ -161,11 +162,11 @@ class Queue {
|
|||
private:
|
||||
QueueNode<E>* head_; // The first node of the queue.
|
||||
QueueNode<E>* last_; // The last node of the queue.
|
||||
size_t size_; // The number of elements in the queue.
|
||||
size_t size_; // The number of elements in the queue.
|
||||
|
||||
// We disallow copying a queue.
|
||||
Queue(const Queue&);
|
||||
const Queue& operator=(const Queue&);
|
||||
const Queue& operator = (const Queue&);
|
||||
};
|
||||
|
||||
#endif // GOOGLETEST_SAMPLES_SAMPLE3_INL_H_
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ namespace {
|
|||
class QueueTestSmpl3 : public testing::Test {
|
||||
protected: // You should make the members protected s.t. they can be
|
||||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
|
|
@ -84,13 +85,15 @@ class QueueTestSmpl3 : public testing::Test {
|
|||
// }
|
||||
|
||||
// A helper function that some test uses.
|
||||
static int Double(int n) { return 2 * n; }
|
||||
static int Double(int n) {
|
||||
return 2*n;
|
||||
}
|
||||
|
||||
// A helper function for testing Queue::Map().
|
||||
void MapTester(const Queue<int>* q) {
|
||||
void MapTester(const Queue<int> * q) {
|
||||
// Creates a new queue, where each element is twice as big as the
|
||||
// corresponding one in q.
|
||||
const Queue<int>* const new_q = q->Map(Double);
|
||||
const Queue<int> * const new_q = q->Map(Double);
|
||||
|
||||
// Verifies that the new queue has the same size as q.
|
||||
ASSERT_EQ(q->Size(), new_q->Size());
|
||||
|
|
@ -121,7 +124,7 @@ TEST_F(QueueTestSmpl3, DefaultConstructor) {
|
|||
|
||||
// Tests Dequeue().
|
||||
TEST_F(QueueTestSmpl3, Dequeue) {
|
||||
int* n = q0_.Dequeue();
|
||||
int * n = q0_.Dequeue();
|
||||
EXPECT_TRUE(n == nullptr);
|
||||
|
||||
n = q1_.Dequeue();
|
||||
|
|
|
|||
|
|
@ -29,22 +29,26 @@
|
|||
|
||||
// A sample program demonstrating using Google C++ testing framework.
|
||||
|
||||
#include "sample4.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sample4.h"
|
||||
|
||||
// Returns the current counter value, and increments it.
|
||||
int Counter::Increment() { return counter_++; }
|
||||
int Counter::Increment() {
|
||||
return counter_++;
|
||||
}
|
||||
|
||||
// Returns the current counter value, and decrements it.
|
||||
// counter can not be less than 0, return 0 in this case
|
||||
int Counter::Decrement() {
|
||||
if (counter_ == 0) {
|
||||
return counter_;
|
||||
} else {
|
||||
} else {
|
||||
return counter_--;
|
||||
}
|
||||
}
|
||||
|
||||
// Prints the current counter value to STDOUT.
|
||||
void Counter::Print() const { printf("%d", counter_); }
|
||||
void Counter::Print() const {
|
||||
printf("%d", counter_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "sample4.h"
|
||||
|
||||
#include "sample4.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
// This sample teaches how to reuse a test fixture in multiple test
|
||||
// cases by deriving sub-fixtures from it.
|
||||
//
|
||||
|
|
@ -44,10 +45,9 @@
|
|||
|
||||
#include <limits.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "sample1.h"
|
||||
#include "sample3-inl.h"
|
||||
#include "gtest/gtest.h"
|
||||
namespace {
|
||||
// In this sample, we want to ensure that every test finishes within
|
||||
// ~5 seconds. If a test takes longer to run, we consider it a
|
||||
|
|
@ -81,6 +81,7 @@ class QuickTest : public testing::Test {
|
|||
time_t start_time_;
|
||||
};
|
||||
|
||||
|
||||
// We derive a fixture named IntegerFunctionTest from the QuickTest
|
||||
// fixture. All tests using this fixture will be automatically
|
||||
// required to be quick.
|
||||
|
|
@ -89,6 +90,7 @@ class IntegerFunctionTest : public QuickTest {
|
|||
// Therefore the body is empty.
|
||||
};
|
||||
|
||||
|
||||
// Now we can write tests in the IntegerFunctionTest test case.
|
||||
|
||||
// Tests Factorial()
|
||||
|
|
@ -108,6 +110,7 @@ TEST_F(IntegerFunctionTest, Factorial) {
|
|||
EXPECT_EQ(40320, Factorial(8));
|
||||
}
|
||||
|
||||
|
||||
// Tests IsPrime()
|
||||
TEST_F(IntegerFunctionTest, IsPrime) {
|
||||
// Tests negative input.
|
||||
|
|
@ -128,6 +131,7 @@ TEST_F(IntegerFunctionTest, IsPrime) {
|
|||
EXPECT_TRUE(IsPrime(23));
|
||||
}
|
||||
|
||||
|
||||
// The next test case (named "QueueTest") also needs to be quick, so
|
||||
// we derive another fixture from QuickTest.
|
||||
//
|
||||
|
|
@ -159,10 +163,13 @@ class QueueTest : public QuickTest {
|
|||
Queue<int> q2_;
|
||||
};
|
||||
|
||||
|
||||
// Now, let's write tests using the QueueTest fixture.
|
||||
|
||||
// Tests the default constructor.
|
||||
TEST_F(QueueTest, DefaultConstructor) { EXPECT_EQ(0u, q0_.Size()); }
|
||||
TEST_F(QueueTest, DefaultConstructor) {
|
||||
EXPECT_EQ(0u, q0_.Size());
|
||||
}
|
||||
|
||||
// Tests Dequeue().
|
||||
TEST_F(QueueTest, Dequeue) {
|
||||
|
|
|
|||
|
|
@ -27,11 +27,13 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
// This sample shows how to test common properties of multiple
|
||||
// implementations of the same interface (aka interface tests).
|
||||
|
||||
// The interface and its implementations are in this header.
|
||||
#include "prime_tables.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
namespace {
|
||||
// First, we define some factory functions for creating instances of
|
||||
|
|
@ -149,7 +151,8 @@ using testing::Types;
|
|||
// the PrimeTableTest fixture defined earlier:
|
||||
|
||||
template <class T>
|
||||
class PrimeTableTest2 : public PrimeTableTest<T> {};
|
||||
class PrimeTableTest2 : public PrimeTableTest<T> {
|
||||
};
|
||||
|
||||
// Then, declare the test case. The argument is the name of the test
|
||||
// fixture, and also the name of the test case (as usual). The _P
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
// This sample shows how to test common properties of multiple
|
||||
// implementations of an interface (aka interface tests) using
|
||||
// value-parameterized tests. Each test in the test case has
|
||||
|
|
@ -35,6 +36,7 @@
|
|||
|
||||
// The interface and its implementations are in this header.
|
||||
#include "prime_tables.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
namespace {
|
||||
|
||||
|
|
@ -48,7 +50,9 @@ using ::testing::Values;
|
|||
// SetUp() method and delete them in TearDown() method.
|
||||
typedef PrimeTable* CreatePrimeTableFunc();
|
||||
|
||||
PrimeTable* CreateOnTheFlyPrimeTable() { return new OnTheFlyPrimeTable(); }
|
||||
PrimeTable* CreateOnTheFlyPrimeTable() {
|
||||
return new OnTheFlyPrimeTable();
|
||||
}
|
||||
|
||||
template <size_t max_precalculated>
|
||||
PrimeTable* CreatePreCalculatedPrimeTable() {
|
||||
|
|
|
|||
|
|
@ -27,12 +27,14 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
// This sample shows how to test code relying on some global flag variables.
|
||||
// Combine() helps with generating all possible combinations of such flags,
|
||||
// and each test is given one combination as a parameter.
|
||||
|
||||
// Use class definitions to test from this header.
|
||||
#include "prime_tables.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
namespace {
|
||||
|
||||
|
|
@ -77,10 +79,10 @@ class HybridPrimeTable : public PrimeTable {
|
|||
int max_precalculated_;
|
||||
};
|
||||
|
||||
using ::testing::Bool;
|
||||
using ::testing::Combine;
|
||||
using ::testing::TestWithParam;
|
||||
using ::testing::Bool;
|
||||
using ::testing::Values;
|
||||
using ::testing::Combine;
|
||||
|
||||
// To test all code paths for HybridPrimeTable we must test it with numbers
|
||||
// both within and outside PreCalculatedPrimeTable's capacity and also with
|
||||
|
|
|
|||
|
|
@ -26,9 +26,10 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
// This sample shows how to use Google Test listener API to implement
|
||||
// an alternative console output and how to use the UnitTest reflection API
|
||||
// to enumerate test suites and tests and to inspect their results.
|
||||
// to enumerate test cases and tests and to inspect their results.
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -37,10 +38,10 @@
|
|||
using ::testing::EmptyTestEventListener;
|
||||
using ::testing::InitGoogleTest;
|
||||
using ::testing::Test;
|
||||
using ::testing::TestCase;
|
||||
using ::testing::TestEventListeners;
|
||||
using ::testing::TestInfo;
|
||||
using ::testing::TestPartResult;
|
||||
using ::testing::TestSuite;
|
||||
using ::testing::UnitTest;
|
||||
namespace {
|
||||
// Provides alternative output mode which produces minimal amount of
|
||||
|
|
@ -58,23 +59,29 @@ class TersePrinter : public EmptyTestEventListener {
|
|||
|
||||
// Called before a test starts.
|
||||
void OnTestStart(const TestInfo& test_info) override {
|
||||
fprintf(stdout, "*** Test %s.%s starting.\n", test_info.test_suite_name(),
|
||||
fprintf(stdout,
|
||||
"*** Test %s.%s starting.\n",
|
||||
test_info.test_case_name(),
|
||||
test_info.name());
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
// Called after a failed assertion or a SUCCEED() invocation.
|
||||
void OnTestPartResult(const TestPartResult& test_part_result) override {
|
||||
fprintf(stdout, "%s in %s:%d\n%s\n",
|
||||
fprintf(stdout,
|
||||
"%s in %s:%d\n%s\n",
|
||||
test_part_result.failed() ? "*** Failure" : "Success",
|
||||
test_part_result.file_name(), test_part_result.line_number(),
|
||||
test_part_result.file_name(),
|
||||
test_part_result.line_number(),
|
||||
test_part_result.summary());
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
// Called after a test ends.
|
||||
void OnTestEnd(const TestInfo& test_info) override {
|
||||
fprintf(stdout, "*** Test %s.%s ending.\n", test_info.test_suite_name(),
|
||||
fprintf(stdout,
|
||||
"*** Test %s.%s ending.\n",
|
||||
test_info.test_case_name(),
|
||||
test_info.name());
|
||||
fflush(stdout);
|
||||
}
|
||||
|
|
@ -94,15 +101,14 @@ TEST(CustomOutputTest, Fails) {
|
|||
}
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int main(int argc, char **argv) {
|
||||
InitGoogleTest(&argc, argv);
|
||||
|
||||
bool terse_output = false;
|
||||
if (argc > 1 && strcmp(argv[1], "--terse_output") == 0)
|
||||
if (argc > 1 && strcmp(argv[1], "--terse_output") == 0 )
|
||||
terse_output = true;
|
||||
else
|
||||
printf("%s\n",
|
||||
"Run this program with --terse_output to change the way "
|
||||
printf("%s\n", "Run this program with --terse_output to change the way "
|
||||
"it prints its output.");
|
||||
|
||||
UnitTest& unit_test = *UnitTest::GetInstance();
|
||||
|
|
@ -143,7 +149,8 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
|
||||
// Test that were meant to fail should not affect the test program outcome.
|
||||
if (unexpectedly_failed_tests == 0) ret_val = 0;
|
||||
if (unexpectedly_failed_tests == 0)
|
||||
ret_val = 0;
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue