[DEV] ad basic test software
This commit is contained in:
parent
302f121b2d
commit
a09c3cf795
0
etk/Hach.h
Normal file
0
etk/Hach.h
Normal file
18
lutin_etktest.py
Normal file
18
lutin_etktest.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import lutinModule
|
||||||
|
import lutinTools
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
def Create(target):
|
||||||
|
# module name is 'edn' and type binary.
|
||||||
|
myModule = lutinModule.module(__file__, 'etktest', 'BINARY')
|
||||||
|
|
||||||
|
# add the file to compile:
|
||||||
|
myModule.AddSrcFile([
|
||||||
|
'test/main.cpp'])
|
||||||
|
|
||||||
|
myModule.AddModuleDepend(['etk'])
|
||||||
|
|
||||||
|
# add the currrent module at the
|
||||||
|
return myModule
|
||||||
|
|
138
test/main.cpp
Normal file
138
test/main.cpp
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license BSD v3 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <etk/Debug.h>
|
||||||
|
#include <etk/Vector.h>
|
||||||
|
#include <etk/UString.h>
|
||||||
|
#include <etk/Hach.h>
|
||||||
|
#include <etk/os/FSNode.h>
|
||||||
|
#include <etk/DebugInternal.h>
|
||||||
|
|
||||||
|
#undef __class__
|
||||||
|
#define __class__ "etktest"
|
||||||
|
|
||||||
|
void testVector(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void testUniChar(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void testUString(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
for(int32_t iii=0; iii<64; iii++) {
|
||||||
|
int64_t kkk=((int64_t)1)<<iii;
|
||||||
|
etk::UString plop(kkk, etk::UString::printModeBinary);
|
||||||
|
TK_DEBUG(" test : " << plop);
|
||||||
|
}
|
||||||
|
for(int32_t iii=0; iii<64; iii++) {
|
||||||
|
int64_t kkk=((int64_t)1)<<iii;
|
||||||
|
etk::UString plop(kkk, etk::UString::printModeOctal);
|
||||||
|
TK_DEBUG(" test : " << plop);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int32_t iii=0; iii<64; iii++) {
|
||||||
|
int64_t kkk=((int64_t)1)<<iii;
|
||||||
|
etk::UString plop(kkk, etk::UString::printModeDecimal);
|
||||||
|
TK_DEBUG(" test : " << plop);
|
||||||
|
int64_t resTest = plop.ToInt32();
|
||||||
|
TK_DEBUG(" test : " << resTest);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int32_t iii=0; iii<64; iii++) {
|
||||||
|
int64_t kkk=((int64_t)1)<<iii;
|
||||||
|
etk::UString plop(kkk, etk::UString::printModeHexadecimal);
|
||||||
|
TK_DEBUG(" test : " << plop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testHash(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void testFSNode(void)
|
||||||
|
{
|
||||||
|
TK_INFO("==> Start test of FSNode");
|
||||||
|
etk::UString fileName("USERDATA:myFileTest.txt");
|
||||||
|
etk::FSNode myNodeTest1(fileName);
|
||||||
|
TK_INFO("********************************************");
|
||||||
|
TK_INFO("** Filename=\"" << fileName << "\"");
|
||||||
|
TK_INFO("********************************************");
|
||||||
|
TK_INFO(" GetNameFolder() =\"" <<myNodeTest1.GetNameFolder() << "\"");
|
||||||
|
TK_INFO(" GetName() =\"" <<myNodeTest1.GetName() << "\"");
|
||||||
|
TK_INFO(" GetNameFile() =\"" <<myNodeTest1.GetNameFile() << "\"");
|
||||||
|
TK_INFO(" GetRelativeFolder() =\"" <<myNodeTest1.GetRelativeFolder() << "\"");
|
||||||
|
TK_INFO(" exist =" <<myNodeTest1.Exist());
|
||||||
|
if (true==myNodeTest1.Exist()) {
|
||||||
|
TK_ERROR(" ==> remove the file ==> bad for the test");
|
||||||
|
} else {
|
||||||
|
TK_INFO(" Display time when file does not exist :");
|
||||||
|
TK_INFO(" TimeCreatedString() =\"" <<myNodeTest1.TimeCreatedString() << "\"");
|
||||||
|
TK_INFO(" TimeModifiedString() =\"" <<myNodeTest1.TimeModifiedString() << "\"");
|
||||||
|
TK_INFO(" TimeAccessedString() =\"" <<myNodeTest1.TimeAccessedString() << "\"");
|
||||||
|
}
|
||||||
|
myNodeTest1.Touch();
|
||||||
|
if (false==myNodeTest1.Exist()) {
|
||||||
|
TK_ERROR(" ==> Error, can not create the file ....");
|
||||||
|
} else {
|
||||||
|
TK_INFO(" Display time when file does exist :");
|
||||||
|
TK_INFO(" TimeCreatedString() =\"" <<myNodeTest1.TimeCreatedString() << "\"");
|
||||||
|
TK_INFO(" TimeModifiedString() =\"" <<myNodeTest1.TimeModifiedString() << "\"");
|
||||||
|
TK_INFO(" TimeAccessedString() =\"" <<myNodeTest1.TimeAccessedString() << "\"");
|
||||||
|
}
|
||||||
|
// Try remove the file :
|
||||||
|
myNodeTest1.Remove();
|
||||||
|
if (true==myNodeTest1.Exist()) {
|
||||||
|
TK_ERROR(" ==> The file might be removed ==> but it is not the case ...");
|
||||||
|
} else {
|
||||||
|
TK_INFO(" ==> The file is removed");
|
||||||
|
}
|
||||||
|
TK_INFO("********************************************");
|
||||||
|
|
||||||
|
|
||||||
|
TK_INFO("==> Stop test of FSNode");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void testDimension(void)
|
||||||
|
{
|
||||||
|
TK_INFO("==> test of Dimension (START)");
|
||||||
|
|
||||||
|
ewol::Dimension myDimention(vec2(5,5), ewol::Dimension::Centimeter);
|
||||||
|
TK_INFO(" set dimension at : " << myDimention);
|
||||||
|
TK_INFO(" set dimension at : " << myDimention.GetCentimeter() << " cm");
|
||||||
|
TK_INFO(" set dimension at : " << myDimention.GetMillimeter() << " mm");
|
||||||
|
TK_INFO(" set dimension at : " << myDimention.GetKilometer() << " km");
|
||||||
|
TK_INFO(" set dimension at : " << myDimention.GetMeter() << " m");
|
||||||
|
TK_INFO(" set dimension at : " << myDimention.GetInch() << " Inch");
|
||||||
|
TK_INFO(" set dimension at : " << myDimention.GetFoot() << " ft");
|
||||||
|
TK_INFO(" set dimension at : " << myDimention.GetPourcent() << " %");
|
||||||
|
TK_INFO(" set dimension at : " << myDimention.GetPixel() << " px");
|
||||||
|
|
||||||
|
TK_INFO("==> test of Dimension (STOP)");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
int main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
// the only one init for etk:
|
||||||
|
GeneralDebugSetLevel(etk::LOG_LEVEL_VERBOSE);
|
||||||
|
testVector();
|
||||||
|
testUniChar();
|
||||||
|
testUString();
|
||||||
|
testHash();
|
||||||
|
testFSNode();
|
||||||
|
//testDimension();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user