void run(){
initTree();
- testToolSync();
+ testDirStatistic();
+
testToolStatistic();
testBasic();
testDirOptions();
testDirStatistic();
testCopyFile();
testList();
+ testToolSync();
}
void testList(){
ReDirTools tools;
ReTraverser traverser(m_base.str());
RePatternList patterns;
// exclude */cache/*
- ReByteBuffer buffer(";*;-*/cache");
+ ReByteBuffer buffer(";*;-cache");
patterns.set(buffer.str());
traverser.setDirPattern(&patterns);
int level = 0;
ReByteBuffer buffer;
ReByteBuffer expected;
log(false, list.join("\n", buffer).str());
- checkEqu(4u, list.count());
+ checkEqu(3u, list.count());
// "1 t:\temp\winfried\2\retestunit\dir1\n"
buffer.set(list.strOf(0), list.strLengthOf(0));
checkT(buffer.startsWith("1\t"));
}
void testToolStatistic(){
ReDirTools tools;
- const char* argv[] = { "dt", "stat", "-P;*;-*/cache/*", m_base.str(), "2" };
+ const char* argv[] = { "dt", "stat", "-P;*;-cache", m_base.str(), "2" };
tools.main(5, (char**) argv);
}
void testToolSync(){
ReByteBuffer source(m_base);
source.append("dir1");
ReByteBuffer target(makeDir("synctest"));
- const char* argv[] = { "dt", "sync", "-P;*;-*/cache/*", "-p;*.txt",
+ const char* argv[] = { "dt", "sync", "-P;*;-cache", "-p;*.txt",
source.str(), target.str() };
tools.main(6, (char**) argv);
}
#include "base/rebase.hpp"
#include "math/remath.hpp"
-//#include "math/md5.hpp"
+#include "math/md5.hpp"
class TestReMd5 : public ReTestUnit {
public:
testBase();
}
void testOld(){
-#if 0
+#if 1
MD5 md5;
md5.update("", 0);
md5.finalize();
void testAll(){
try
{
- testOs();
+ testMath();
testBase();
testString();
uint32_t C = m_c0;
uint32_t D = m_d0;
//Main loop:
+
int F, g;
for (int i = 0; i < 64; i++){
+#if defined TRACE_MD5
+ printf("%2d: A: %08x B: %08x C: %08x D%08x\n", i, A, B, C, D);
+#endif
if (i < 16){
// F := (B and C) or ((not B) and D)
F = (B & C) | (~ B & D);
// g := (7×i) mod 16
g = (7*i) % 16;
}
+#if defined TRACE_MD5
+ printf(" K[%2d]: %08x M[%2d]: %08x shift: %02d\n",
+ i, m_K[i], g, M[g], m_s[i]);
+#endif
uint32_t dTemp = D;
D = C;
C = B;
inline MD5::uint4 MD5::rotate_left(uint4 x, int n) {
return (x << n) | (x >> (32-n));
}
-
+static int s_ix = 0;
// FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
// Rotation is separate from addition to prevent recomputation.
inline void MD5::FF(uint4 &a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac) {
- a = rotate_left(a+ F(b,c,d) + x + ac, s) + b;
+#if defined TRACE_MD5
+ printf("%2d: A: %08x B: %08x C: %08x D%08x\n", s_ix++ % 16, a, b, c, d);
+ printf(" K[%2d]: %08x M[?]: %08x shift: %02d ac: %08x\n",
+ s_ix - 1, 0xd76aa478, x, s, ac);
+#endif
+ a = rotate_left(a+ F(b,c,d) + x + ac, s) + b;
}
inline void MD5::GG(uint4 &a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac) {
value);\r
if (strchr(value, OS_SEPARATOR_CHAR) != NULL)\r
throw ReOptionException(&m_programArgs, \r
- i18n("slash not allowed in pattern list: $2"), value);\r
+ i18n("slash not allowed in pattern list: $1"), value);\r
return value;\r
}\r
/**\r
* @param filter OUT: the filter to set\r
*/\r
void ReDirOptions::setFilterFromProgramArgs(ReDirEntryFilter_t& filter){\r
-{ ReByteBuffer buf;\r
-const char* ptr = m_programArgs.getString("pathpattern", buf);\r
-}\r
ReByteBuffer buffer;\r
if (m_programArgs.getString("younger", buffer)[0] != '\0')\r
filter.m_maxAge = checkDate(buffer.str());\r
*/\r
ReDirEntryFilter_t::ReDirEntryFilter_t() :\r
m_types(ReDirStatus_t::TC_ALL),\r
- m_nodePatterns(),\r
- m_pathPatterns(),\r
+ m_nodePatterns(NULL),\r
+ m_pathPatterns(NULL),\r
m_minSize(0),\r
m_maxSize(-1),\r
m_minAge(0),\r
* @param pattern pattern list for the subdirs to be entered
*/
void setDirPattern(RePatternList* pattern)
- { m_dirPatterns = pattern; m_dirPatterns->setIgnoreCase(true); }
+ { m_dirPatterns = pattern;
+ if (pattern != NULL)
+ m_dirPatterns->setIgnoreCase(true);
+ }
/** Sets the maximal depth.
* @param value the value to set
*/