Skip to content

Commit

Permalink
TESTS: Add test for a multi-level NWN2 PC
Browse files Browse the repository at this point in the history
  • Loading branch information
rjshae authored and DrMcCoy committed Feb 2, 2019
1 parent ff76e48 commit 4bbb054
Show file tree
Hide file tree
Showing 2 changed files with 2,464 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/engines/nwn2/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "gtest/gtest.h"

#include "tests/engines/nwn2/creature.h"
#include "tests/engines/nwn2/creature2.h"

#include "src/common/memreadstream.h"
#include "src/common/scopedptr.h"
Expand Down Expand Up @@ -102,3 +103,18 @@ GTEST_TEST(NWN2Creature, creature1) {
cr->getOrientation(x, y, z, angle);
EXPECT_TRUE(abs(angle) < kEpsilon);
}

GTEST_TEST(NWN2Creature, creature2) {
Common::ScopedPtr<Common::MemoryReadStream> stream(new Common::MemoryReadStream(kDataCreature2));
if (!stream)
throw Common::Exception("No test data available");
Common::ScopedPtr<Aurora::GFF3File> gff(new Aurora::GFF3File(stream.release(), MKTAG('B', 'I', 'C', ' ')));

// Load the PC
const Aurora::GFF3Struct &top = gff->getTopLevel();
Common::ScopedPtr<Engines::NWN2::Creature> cr(new Engines::NWN2::Creature(top));

EXPECT_EQ(cr->getRace(), 21);
EXPECT_EQ(cr->getSubRace(), 20);
EXPECT_EQ(cr->getGender(), 1);
}

0 comments on commit 4bbb054

Please sign in to comment.