单元测试作为静态方法
This commit is contained in:
parent
ffe026e251
commit
2de60fa287
|
@ -52,6 +52,10 @@ public:
|
|||
friend bool operator==(const Array& bs1, const Array& bs2);
|
||||
friend bool operator!=(const Array& bs1, const Array& bs2);
|
||||
|
||||
#if DEBUG
|
||||
static void Test();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
uint _Capacity; // 最大个数。非字节数
|
||||
bool _needFree; // 是否需要释放
|
||||
|
|
|
@ -96,6 +96,10 @@ public:
|
|||
friend bool operator != (const Buffer& bs1, const Buffer& bs2);
|
||||
friend bool operator != (const Buffer& bs1, const void* ptr);
|
||||
|
||||
#if DEBUG
|
||||
static void Test();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
char* _Arr; // 数据指针
|
||||
int _Length; // 长度
|
||||
|
|
|
@ -32,6 +32,10 @@ public:
|
|||
//friend bool operator==(const ByteArray& bs1, const ByteArray& bs2);
|
||||
//friend bool operator!=(const ByteArray& bs1, const ByteArray& bs2);
|
||||
|
||||
#if DEBUG
|
||||
static void Test();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
byte Arr[0x40]; // 内部缓冲区
|
||||
|
||||
|
|
|
@ -71,6 +71,10 @@ public:
|
|||
// 当前时间
|
||||
static DateTime Now();
|
||||
|
||||
#if DEBUG
|
||||
static void Test();
|
||||
#endif
|
||||
|
||||
private:
|
||||
void Init();
|
||||
Buffer ToArray();
|
||||
|
|
|
@ -30,6 +30,10 @@ public:
|
|||
void* operator[](const void* key) const;
|
||||
void*& operator[](const void* key);
|
||||
|
||||
#if DEBUG
|
||||
static void Test();
|
||||
#endif
|
||||
|
||||
private:
|
||||
List _Keys;
|
||||
List _Values;
|
||||
|
|
|
@ -38,6 +38,10 @@ public:
|
|||
void* operator[](int i) const;
|
||||
void*& operator[](int i);
|
||||
|
||||
#if DEBUG
|
||||
static void Test();
|
||||
#endif
|
||||
|
||||
private:
|
||||
void** _Arr;
|
||||
uint _Count;
|
||||
|
|
|
@ -159,6 +159,10 @@ public:
|
|||
String ToLower() const;
|
||||
String ToUpper() const;
|
||||
|
||||
#if DEBUG
|
||||
static void Test();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
//char* _Arr; // 字符数组
|
||||
//int _Capacity; // 容量,不包含0结束符
|
||||
|
|
|
@ -84,7 +84,7 @@ static void TestCopy()
|
|||
assert(arr.Length() == sizeof(bts) && arr == bts, err);
|
||||
}
|
||||
|
||||
void TestArray()
|
||||
void Array::Test()
|
||||
{
|
||||
TS("TestArray");
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ static void TestCopy(const Buffer& bs)
|
|||
assert(bs2 == cs + 8, err);
|
||||
}
|
||||
|
||||
void TestBuffer()
|
||||
void Buffer::Test()
|
||||
{
|
||||
TS("TestBuffer");
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ static void TestCtor()
|
|||
assert(dt3.Hour == 0 && dt3.Minute == 0 && dt3.Second == 33 && dt3.Ms == 00, "DateTime(uint seconds)");
|
||||
}
|
||||
|
||||
static void ParseMs()
|
||||
static void TestParseMs()
|
||||
{
|
||||
TS("TestCtor");
|
||||
|
||||
|
@ -41,13 +41,13 @@ static void TestTotal()
|
|||
assert(dt.TotalMs() == 1463443233UL * 1000, "TotalMs");
|
||||
}
|
||||
|
||||
void TestDateTime()
|
||||
void DateTime::Test()
|
||||
{
|
||||
debug_printf("\r\n");
|
||||
debug_printf("TestDateTime Start......\r\n");
|
||||
|
||||
TestCtor();
|
||||
ParseMs();
|
||||
TestParseMs();
|
||||
TestTotal();
|
||||
|
||||
debug_printf("\r\n TestDateTime Finish!\r\n");
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "Dictionary.h"
|
||||
|
||||
#if DEBUG
|
||||
void TestDictionary()
|
||||
void Dictionary::Test()
|
||||
{
|
||||
TS("TestDictionary");
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "List.h"
|
||||
|
||||
#if DEBUG
|
||||
void TestList()
|
||||
void List::Test()
|
||||
{
|
||||
TS("TestList");
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ static void TestMemory()
|
|||
}
|
||||
}
|
||||
|
||||
void TestString()
|
||||
void String::Test()
|
||||
{
|
||||
TS("TestString");
|
||||
|
||||
|
|
|
@ -25,10 +25,4 @@ NRF24L01* Create2401();
|
|||
|
||||
void TestMessage(OutputPort* leds);
|
||||
|
||||
void TestBuffer();
|
||||
void TestString();
|
||||
void TestArray();
|
||||
void TestDateTime();
|
||||
void TestList();
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue