-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a unit test to check Quat::FromString works independent of the …
…locale that is used.
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#include "MathGeoLib.h" | ||
#include "myassert.h" | ||
#include "TestRunner.h" | ||
|
||
extern LCG rng; | ||
|
||
void TestQuat4FromString() | ||
{ | ||
const char *locales[] = { "C", "en", "fi" }; // From http://www.loc.gov/standards/iso639-2/php/code_list.php | ||
|
||
for(int i = 0; i < sizeof(locales)/sizeof(locales[0]); ++i) | ||
{ | ||
setlocale(LC_ALL, locales[i]); | ||
assert(Quat::FromString("1, +2, 3.1, -4").Equals(Quat(1,2,3.1f,-4))); | ||
assert(Quat::FromString("(1, +2, 3.1, -4").Equals(Quat(1,2,3.1f,-4))); | ||
assert(Quat::FromString("(1, +2, 3.1, -4)").Equals(Quat(1,2,3.1f,-4))); | ||
|
||
assert(Quat::FromString("1,+2,3.1, -4").Equals(Quat(1,2,3.1f,-4))); | ||
assert(Quat::FromString("(1,+2,3.1, -4").Equals(Quat(1,2,3.1f,-4))); | ||
assert(Quat::FromString("(1,+2,3.1, -4)").Equals(Quat(1,2,3.1f,-4))); | ||
|
||
assert(Quat::FromString("1 +2 3.1 -4").Equals(Quat(1,2,3.1f,-4))); | ||
assert(Quat::FromString("(1 +2 3.1 -4").Equals(Quat(1,2,3.1f,-4))); | ||
assert(Quat::FromString("(1 +2 3.1 -4)").Equals(Quat(1,2,3.1f,-4))); | ||
} | ||
} | ||
|
||
void AddSerializationTests() | ||
{ | ||
AddTest("Quat4::FromString", TestQuat4FromString); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters