Browse Subversion Repository
Contents of /unittest/ArrayTestUtil.h
Parent Directory
| Revision Log
Revision 177 -
( show annotations)
( download)
( as text)
Tue Dec 11 09:52:07 2007 UTC
(16 years, 5 months ago)
by satofumi
File MIME type: text/x-chdr
File size: 763 byte(s)
add sound.
| 1 |
#ifndef TEST_UTILS_H |
| 2 |
#define TEST_UTILS_H |
| 3 |
|
| 4 |
/*! |
| 5 |
\file |
| 6 |
\brief テスト用の補助モジュール |
| 7 |
|
| 8 |
\author Satofumi KAMIMURA |
| 9 |
|
| 10 |
$Id$ |
| 11 |
*/ |
| 12 |
|
| 13 |
#include <iostream> |
| 14 |
|
| 15 |
|
| 16 |
template<class T> |
| 17 |
bool isEqualArray(const T* expected, const T* actual, int size) { |
| 18 |
int i; |
| 19 |
for (i = 0; i < size; ++i) { |
| 20 |
if (expected[i] != actual[i]) { |
| 21 |
break; |
| 22 |
} |
| 23 |
} |
| 24 |
if (i == size) { |
| 25 |
return true; |
| 26 |
} |
| 27 |
|
| 28 |
// expect と actual を表示 |
| 29 |
std::cout << std::endl << "- Expected: "; |
| 30 |
for (int i = 0; i < size; ++i) { |
| 31 |
std::cout << std::hex << *(expected + i) << " "; |
| 32 |
} |
| 33 |
std::cout << std::endl; |
| 34 |
|
| 35 |
std::cout << "- Actual : "; |
| 36 |
for (int i = 0; i < size; ++i) { |
| 37 |
std::cout << std::hex << *(actual + i) << " "; |
| 38 |
} |
| 39 |
std::cout << std::endl; |
| 40 |
|
| 41 |
return false; |
| 42 |
} |
| 43 |
|
| 44 |
#endif /* !TEST_UTILS_H */ |
|