platformStringTests.cc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2013 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. // We don't want tests in a shipping version.
  23. #ifndef TORQUE_SHIPPING
  24. #ifndef _UNIT_TESTING_H_
  25. #include "testing/unitTesting.h"
  26. #endif
  27. #ifndef _PLATFORM_H_
  28. #include "platform/platform.h"
  29. #endif
  30. //-----------------------------------------------------------------------------
  31. #define PLATFORM_UNITTEST_STRING_DESTINATION_BUFFERSIZE 1024
  32. //-----------------------------------------------------------------------------
  33. TEST( PlatformStringTests, dStrlenTest )
  34. {
  35. // Check length of string.
  36. ASSERT_EQ( (S32)dStrlen("GarageGames"), 11 ) << "String length failed.";
  37. }
  38. //-----------------------------------------------------------------------------
  39. TEST( PlatformStringTests, dStrcatTest )
  40. {
  41. char source[] = { "Games" };
  42. char destination[] = { "Garage\0XXXXX" };
  43. // Concatenate.
  44. char* pResult = dStrcat( destination, source );
  45. // Check result.
  46. ASSERT_EQ( pResult, destination );
  47. ASSERT_STREQ( "GarageGames", pResult ) << "Concatenation failed.";
  48. }
  49. //-----------------------------------------------------------------------------
  50. TEST( PlatformStringTests, dStrncatTest )
  51. {
  52. char source[] = { "Games" };
  53. char destination[] = { "Garage\0XXXXX" };
  54. // Concatenate.
  55. char* pResult = dStrncat( destination, source, 3 );
  56. // Check result.
  57. ASSERT_EQ( pResult, destination );
  58. ASSERT_STREQ( "GarageGam", pResult ) << "Explicit-length concatenation failed.";
  59. }
  60. //-----------------------------------------------------------------------------
  61. TEST( PlatformStringTests, dStrcatlTest )
  62. {
  63. char destination[] = { "Garage\0XXXXX" };
  64. // Concatenate.
  65. char* pResult = dStrcatl( destination, sizeof(destination), "G", "am", "e", "s", NULL );
  66. // Check result.
  67. ASSERT_STREQ( "GarageGames", destination ) << "Variadic concatenation failed.";
  68. ASSERT_STREQ( "GarageGames", pResult ) << "Variadic concatenation failed.";
  69. }
  70. //-----------------------------------------------------------------------------
  71. TEST( PlatformStringTests, dStrcmp8Test )
  72. {
  73. UTF8 source1[] = { "garageGames" };
  74. UTF8 source2[] = { "GarageGames" };
  75. UTF8 source3[] = { "GarageGame" };
  76. UTF8 destination[] = { "GarageGames" };
  77. // Compare.
  78. ASSERT_GT( dStrcmp( source1, destination ), 0 ) << "Case-sensitive UTF8 compare failed.";
  79. ASSERT_EQ( dStrcmp( source2, destination ), 0 ) << "Case-sensitive UTF8 compare failed.";
  80. ASSERT_LT( dStrcmp( source3, destination ), 0 ) << "Case-sensitive UTF8 compare failed.";
  81. }
  82. //-----------------------------------------------------------------------------
  83. TEST( PlatformStringTests, dStrcmp16Test )
  84. {
  85. UTF16 source1[] = { 1001, 2000, 3000, 4000, 0 };
  86. UTF16 source2[] = { 1000, 2000, 3000, 4000, 0 };
  87. UTF16 source3[] = { 1000, 2000, 3000, 0 };
  88. UTF16 destination[] = { 1000, 2000, 3000, 4000, 0 };
  89. // Compare.
  90. ASSERT_LT( 0, dStrcmp( source1, destination ) ) << "Case-sensitive UTF16 compare failed.";
  91. ASSERT_EQ( 0, dStrcmp( source2, destination ) ) << "Case-sensitive UTF16 compare failed.";
  92. ASSERT_GT( 0, dStrcmp( source3, destination ) ) << "Case-sensitive UTF16 compare failed.";
  93. }
  94. //-----------------------------------------------------------------------------
  95. TEST( PlatformStringTests, dStricmpTest )
  96. {
  97. char source1[] = { "GaRaGeGaMeS!" };
  98. char source2[] = { "GaRaGeGaMeS" };
  99. char source3[] = { "GaRaGeGaMe" };
  100. char destination[] = { "GarageGames" };
  101. // Compare.
  102. ASSERT_GT( dStricmp( source1, destination ), 0 ) << "Case-insensitive compare failed.";
  103. ASSERT_EQ( dStricmp( source2, destination ), 0 ) << "Case-insensitive compare failed.";
  104. ASSERT_LT( dStricmp( source3, destination ), 0 ) << "Case-insensitive compare failed.";
  105. }
  106. //-----------------------------------------------------------------------------
  107. TEST( PlatformStringTests, dStrncmpTest )
  108. {
  109. char source1[] = { "GG*" };
  110. char source2[] = { "GG!" };
  111. char source3[] = { "GG " };
  112. char destination[] = { "GG!" };
  113. // Compare.
  114. ASSERT_GT( dStrncmp( source1, destination, sizeof(destination) ), 0 ) << "Case-sensitive compare failed.";
  115. ASSERT_EQ( dStrncmp( source2, destination, sizeof(destination) ), 0 ) << "Case-sensitive compare failed.";
  116. ASSERT_LT( dStrncmp( source3, destination, sizeof(destination) ), 0 ) << "Case-sensitive compare failed.";
  117. }
  118. //-----------------------------------------------------------------------------
  119. TEST( PlatformStringTests, dStrnicmpTest )
  120. {
  121. char source1[] = { "gG*" };
  122. char source2[] = { "gg!" };
  123. char source3[] = { "Gg " };
  124. char destination[] = { "GG!" };
  125. // Compare.
  126. ASSERT_GT( dStrnicmp( source1, destination, sizeof(destination) ), 0 ) << "Case-insensitive compare failed.";
  127. ASSERT_EQ( dStrnicmp( source2, destination, sizeof(destination) ), 0 ) << "Case-insensitive compare failed.";
  128. ASSERT_LT( dStrnicmp( source3, destination, sizeof(destination) ), 0 ) << "Case-insensitive compare failed.";
  129. }
  130. //-----------------------------------------------------------------------------
  131. TEST( PlatformStringTests, dStrcpyTest )
  132. {
  133. char source[] = { "GarageGames" };
  134. char destination[sizeof(source)+1];
  135. // Copy.
  136. char* pResult = dStrcpy( destination, source );
  137. // Check results.
  138. ASSERT_EQ( pResult, destination );
  139. ASSERT_STREQ( "GarageGames", destination ) << "Copy failed.";
  140. ASSERT_STREQ( pResult, destination ) << "Copy failed.";
  141. }
  142. //-----------------------------------------------------------------------------
  143. TEST( PlatformStringTests, dStrcpylTest )
  144. {
  145. char destination[] = { "GarageGames" };
  146. // Copy.
  147. char* pResult = dStrcpyl( destination, sizeof(destination), "G", "ar", "a", "ge", "Ga", "me", "s", NULL );
  148. // Check result.
  149. ASSERT_EQ( pResult, destination );
  150. ASSERT_STREQ( "GarageGames", destination ) << "Variadic copy failed.";
  151. ASSERT_STREQ( "GarageGames", pResult ) << "Variadic copy failed.";
  152. }
  153. //-----------------------------------------------------------------------------
  154. TEST( PlatformStringTests, dStruprTest )
  155. {
  156. char source[] = { "GarageGames" };
  157. // Convert.
  158. char* pResult = dStrupr( source );
  159. // Check results.
  160. ASSERT_STREQ( "GARAGEGAMES", pResult ) << "Uppercase conversion failed.";
  161. }
  162. //-----------------------------------------------------------------------------
  163. TEST( PlatformStringTests, dStrlwrTest )
  164. {
  165. char source[] = { "GarageGames" };
  166. // Convert.
  167. char* pResult = dStrlwr( source );
  168. // Check results.
  169. ASSERT_STREQ( "garagegames", pResult ) << "Lowercase conversion failed.";
  170. }
  171. //-----------------------------------------------------------------------------
  172. TEST( PlatformStringTests, dToupperTest )
  173. {
  174. // Convert.
  175. S32 index = 0;
  176. for ( char character = 'a'; character <= 'z'; character++, index++ )
  177. {
  178. // Check results.
  179. ASSERT_EQ( (char)('A' + index), dToupper( character) ) << "Uppercase conversion incorrect.";
  180. }
  181. }
  182. //-----------------------------------------------------------------------------
  183. TEST( PlatformStringTests, dTolowerTest )
  184. {
  185. // Convert.
  186. S32 index = 0;
  187. for ( char character = 'A'; character <= 'Z'; character++, index++ )
  188. {
  189. // Check results.
  190. ASSERT_EQ( (char)('a' + index), dTolower( character) ) << "Lowercase conversion incorrect.";
  191. }
  192. }
  193. //-----------------------------------------------------------------------------
  194. TEST( PlatformStringTests, dStrchrTest )
  195. {
  196. char source[] = { "GarageGames" };
  197. // Find.
  198. char* pResult1 = dStrchr( source, 'm' );
  199. char* pResult2 = dStrchr( source, 'z' );
  200. // Check results.
  201. ASSERT_STREQ( "mes", pResult1 ) << "Could not find character.";
  202. ASSERT_EQ( 0, pResult2 ) << "Should not have found character,";
  203. }
  204. //-----------------------------------------------------------------------------
  205. TEST( PlatformStringTests, dStrchrCONSTTest )
  206. {
  207. char source[] = { "GarageGames" };
  208. // Find.
  209. const char* pResult1 = dStrchr( (const char*)source, 'm' );
  210. const char* pResult2 = dStrchr( (const char*)source, 'z' );
  211. // Check results.
  212. ASSERT_STREQ( "mes", pResult1 ) << "Could not find character.";
  213. ASSERT_EQ( 0, pResult2 ) << "Should not have found character,";
  214. }
  215. //-----------------------------------------------------------------------------
  216. TEST( PlatformStringTests, dStrrchrTest )
  217. {
  218. char source[] = { "GarageGames" };
  219. // Find.
  220. char* pResult1 = dStrrchr( source, 'G' );
  221. char* pResult2 = dStrrchr( source, 'z' );
  222. // Check results.
  223. ASSERT_STREQ( "Games", pResult1 ) << "Could not find character.";
  224. ASSERT_EQ( 0, pResult2 ) << "Should not have found character,";
  225. }
  226. //-----------------------------------------------------------------------------
  227. TEST( PlatformStringTests, dStrrchrCONSTTest )
  228. {
  229. char source[] = { "GarageGames" };
  230. // Find.
  231. const char* pResult1 = dStrrchr( (const char*)source, 'G' );
  232. const char* pResult2 = dStrrchr( (const char*)source, 'z' );
  233. // Check results.
  234. ASSERT_STREQ( "Games", pResult1 ) << "Could not find character.";
  235. ASSERT_EQ( 0, pResult2 ) << "Should not have found character,";
  236. }
  237. //-----------------------------------------------------------------------------
  238. TEST( PlatformStringTests, dStrspnTest )
  239. {
  240. char source[] = { "Garage_Games!" };
  241. // Find.
  242. const S32 result = (S32)dStrspn( source, "Gargeams" );
  243. // Check results.
  244. ASSERT_EQ( 6, result ) << "Invalid index for string find.";
  245. }
  246. //-----------------------------------------------------------------------------
  247. TEST( PlatformStringTests, dStrcspnTest )
  248. {
  249. char source[] = { "Garage_Games!" };
  250. // Find.
  251. const S32 result = (S32)dStrcspn( source, "_!" );
  252. // Check results.
  253. ASSERT_EQ( 6, result ) << "Invalid index for string find.";
  254. }
  255. //-----------------------------------------------------------------------------
  256. TEST( PlatformStringTests, dStrstrTest )
  257. {
  258. char source1[] = { "GarageGames" };
  259. char source2[] = { "Games" };
  260. // Find.
  261. char* pResult = dStrstr( source1, source2 );
  262. // Check results.
  263. ASSERT_STREQ( "Games", pResult ) << "Could not find string.";
  264. }
  265. //-----------------------------------------------------------------------------
  266. TEST( PlatformStringTests, dStrstrCONSTTest )
  267. {
  268. char source1[] = { "GarageGames" };
  269. char source2[] = { "Games" };
  270. // Find.
  271. const char* pResult = dStrstr( (const char*)source1, (const char*)source2 );
  272. // Check results.
  273. ASSERT_STREQ( "Games", pResult ) << "Could not find string.";
  274. }
  275. //-----------------------------------------------------------------------------
  276. TEST( PlatformStringTests, dStrtokTest )
  277. {
  278. char source[] = { "Mich,Melv\nKyle\tRichard\nRon" };
  279. char separators[] = { ",\n\t\n" };
  280. // Find.
  281. char* pResult1 = dStrtok( source, separators );
  282. char* pResult2 = dStrtok( NULL, separators );
  283. char* pResult3 = dStrtok( NULL, separators );
  284. char* pResult4 = dStrtok( NULL, separators );
  285. char* pResult5 = dStrtok( NULL, separators );
  286. char* pResult6 = dStrtok( NULL, separators );
  287. // Check results.
  288. ASSERT_STREQ( "Mich", pResult1 ) << "Token find is incorrect.";
  289. ASSERT_STREQ( "Melv", pResult2 ) << "Token find is incorrect.";
  290. ASSERT_STREQ( "Kyle", pResult3 ) << "Token find is incorrect.";
  291. ASSERT_STREQ( "Richard", pResult4 ) << "Token find is incorrect.";
  292. ASSERT_STREQ( "Ron", pResult5 ) << "Token find is incorrect.";
  293. ASSERT_EQ( 0, pResult6 ) << "Token find is incorrect.";
  294. }
  295. //-----------------------------------------------------------------------------
  296. TEST( PlatformStringTests, dStrrevTest )
  297. {
  298. char destination[] = { "GarageGames" };
  299. // Find.
  300. const S32 result = dStrrev( destination );
  301. // Check results.
  302. ASSERT_STREQ( "semaGegaraG", destination ) << "String reverse is incorrect.";
  303. ASSERT_EQ( 5, result ) << "String reverse is incorrect.";
  304. }
  305. //-----------------------------------------------------------------------------
  306. TEST( PlatformStringTests, dAtoiTest )
  307. {
  308. char source1[] = { "16384" };
  309. char source2[] = { "-16384" };
  310. char source3[] = { "256.5" };
  311. char source4[] = { "-256.5" };
  312. // Find.
  313. const S32 result1 = dAtoi( source1 );
  314. const S32 result2 = dAtoi( source2 );
  315. const S32 result3 = dAtoi( source3 );
  316. const S32 result4 = dAtoi( source4 );
  317. // Check results.
  318. ASSERT_EQ( 16384, result1 ) << "Conversion incorrect.";
  319. ASSERT_EQ( -16384, result2 ) << "Conversion incorrect.";
  320. ASSERT_EQ( 256, result3 ) << "Conversion incorrect.";
  321. ASSERT_EQ( -256, result4 ) << "Conversion incorrect.";
  322. }
  323. //-----------------------------------------------------------------------------
  324. TEST( PlatformStringTests, dAtofTest )
  325. {
  326. char source1[] = { "123.45" };
  327. char source2[] = { "-123.45" };
  328. char source3[] = { "256.0" };
  329. char source4[] = { "-256.0" };
  330. // Find.
  331. const F32 result1 = dAtof( source1 );
  332. const F32 result2 = dAtof( source2 );
  333. const F32 result3 = dAtof( source3 );
  334. const F32 result4 = dAtof( source4 );
  335. // Check results.
  336. ASSERT_EQ( 123.45f, result1 ) << "Conversion incorrect.";
  337. ASSERT_EQ( -123.45f, result2 ) << "Conversion incorrect.";
  338. ASSERT_EQ( 256.0f, result3 ) << "Conversion incorrect.";
  339. ASSERT_EQ( -256.0f, result4 ) << "Conversion incorrect.";
  340. }
  341. //-----------------------------------------------------------------------------
  342. TEST( PlatformStringTests, dAtobTest )
  343. {
  344. char source1[] = { "1" };
  345. char source2[] = { "0" };
  346. char source3[] = { "100" };
  347. char source4[] = { "-100" };
  348. char source5[] = { "true" };
  349. char source6[] = { "false" };
  350. char source7[] = { "I refute it thus!" };
  351. // Find.
  352. const bool result1 = dAtob( source1 );
  353. const bool result2 = dAtob( source2 );
  354. const bool result3 = dAtob( source3 );
  355. const bool result4 = dAtob( source4 );
  356. const bool result5 = dAtob( source5 );
  357. const bool result6 = dAtob( source6 );
  358. const bool result7 = dAtob( source7 );
  359. // Check results.
  360. ASSERT_EQ( true, result1 ) << "Conversion incorrect.";
  361. ASSERT_EQ( false, result2 ) << "Conversion incorrect.";
  362. ASSERT_EQ( true, result3 ) << "Conversion incorrect.";
  363. ASSERT_EQ( true, result4 ) << "Conversion incorrect.";
  364. ASSERT_EQ( true, result5 ) << "Conversion incorrect.";
  365. ASSERT_EQ( false, result6 ) << "Conversion incorrect.";
  366. ASSERT_EQ( false, result7 ) << "Conversion incorrect.";
  367. }
  368. //-----------------------------------------------------------------------------
  369. TEST( PlatformStringTests, dItoaTest )
  370. {
  371. char destination1[64];
  372. char destination2[64];
  373. char destination3[64];
  374. char destination4[64];
  375. // Find.
  376. const S32 result1 = dItoa( 16384, destination1 );
  377. const S32 result2 = dItoa( -16384, destination2 );
  378. const S32 result3 = dItoa( 256, destination3 );
  379. const S32 result4 = dItoa( -256, destination4 );
  380. // Check results.
  381. ASSERT_STREQ( "16384", destination1 ) << "Conversion incorrect.";
  382. ASSERT_STREQ( "-16384", destination2 ) << "Conversion incorrect.";
  383. ASSERT_STREQ( "256", destination3 ) << "Conversion incorrect.";
  384. ASSERT_STREQ( "-256", destination4 ) << "Conversion incorrect.";
  385. ASSERT_EQ( 5, result1 ) << "Conversion incorrect.";
  386. ASSERT_EQ( 5+1, result2 ) << "Conversion incorrect.";
  387. ASSERT_EQ( 3, result3 ) << "Conversion incorrect.";
  388. ASSERT_EQ( 3+1, result4 ) << "Conversion incorrect.";
  389. }
  390. //-----------------------------------------------------------------------------
  391. TEST( PlatformStringTests, dIsalnumTest )
  392. {
  393. char source1[] = { "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" };
  394. char source2[] = { "!$%^&*()+-={}[]~#@':;?/>.<,|`" };
  395. // Check results on source#1.
  396. const S32 sourceLength1 = dStrlen( source1 );
  397. for ( S32 index = 0; index < sourceLength1; ++index )
  398. {
  399. ASSERT_EQ( true, dIsalnum(source1[index]) );
  400. }
  401. // Check results on source#2.
  402. const S32 sourceLength2 = dStrlen( source2 );
  403. for ( S32 index = 0; index < sourceLength2; ++index )
  404. {
  405. ASSERT_EQ( false, dIsalnum(source2[index]) );
  406. }
  407. }
  408. //-----------------------------------------------------------------------------
  409. TEST( PlatformStringTests, dIsalphaTest )
  410. {
  411. char source1[] = { "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" };
  412. char source2[] = { "!$%^&*()+-={}[]~#@':;?/>.<,|`" };
  413. char source3[] = { "0123456789" };
  414. // Check results on source#1.
  415. const S32 sourceLength1 = dStrlen( source1 );
  416. for ( S32 index = 0; index < sourceLength1; ++index )
  417. {
  418. ASSERT_EQ( true, dIsalpha(source1[index]) );
  419. }
  420. // Check results on source#2.
  421. const S32 sourceLength2 = dStrlen( source2 );
  422. for ( S32 index = 0; index < sourceLength2; ++index )
  423. {
  424. ASSERT_EQ( false, dIsalpha(source2[index]) );
  425. }
  426. // Check results on source#3.
  427. const S32 sourceLength3 = dStrlen( source3 );
  428. for ( S32 index = 0; index < sourceLength3; ++index )
  429. {
  430. ASSERT_EQ( false, dIsalpha(source3[index]) );
  431. }
  432. }
  433. //-----------------------------------------------------------------------------
  434. TEST( PlatformStringTests, dIsdigitTest )
  435. {
  436. char source1[] = { "0123456789" };
  437. char source2[] = { "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" };
  438. char source3[] = { "!$%^&*()+-={}[]~#@':;?/>.<,|`" };
  439. // Check results on source#1.
  440. const S32 sourceLength1 = dStrlen( source1 );
  441. for ( S32 index = 0; index < sourceLength1; ++index )
  442. {
  443. ASSERT_EQ( true, dIsdigit(source1[index]) );
  444. }
  445. // Check results on source#2.
  446. const S32 sourceLength2 = dStrlen( source2 );
  447. for ( S32 index = 0; index < sourceLength2; ++index )
  448. {
  449. ASSERT_EQ( false, dIsdigit(source2[index]) );
  450. }
  451. // Check results on source#3.
  452. const S32 sourceLength3 = dStrlen( source3 );
  453. for ( S32 index = 0; index < sourceLength3; ++index )
  454. {
  455. ASSERT_EQ( false, dIsdigit(source3[index]) );
  456. }
  457. }
  458. //-----------------------------------------------------------------------------
  459. TEST( PlatformStringTests, dIsspaceTest )
  460. {
  461. char source1[] = { "\t\r " };
  462. char source2[] = { "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" };
  463. char source3[] = { "!$%^&*()+-={}[]~#@':;?/>.<,|`" };
  464. // Check results on source#1.
  465. const S32 sourceLength1 = dStrlen( source1 );
  466. for ( S32 index = 0; index < sourceLength1; ++index )
  467. {
  468. ASSERT_EQ( true, dIsspace(source1[index]) );
  469. }
  470. // Check results on source#2.
  471. const S32 sourceLength2 = dStrlen( source2 );
  472. for ( S32 index = 0; index < sourceLength2; ++index )
  473. {
  474. ASSERT_EQ( false, dIsspace(source2[index]) );
  475. }
  476. // Check results on source#3.
  477. const S32 sourceLength3 = dStrlen( source3 );
  478. for ( S32 index = 0; index < sourceLength3; ++index )
  479. {
  480. ASSERT_EQ( false, dIsspace(source3[index]) );
  481. }
  482. }
  483. #endif // TORQUE_SHIPPING