-#ifndef YENC_H
-#define YENC_H
+#pragma once
#include "test.qh"
#define yenc_single(c, ret) \
- MACRO_BEGIN { \
+ MACRO_BEGIN \
int conv = c; \
conv += 42; \
if (conv >= 256) conv -= 256; \
break; \
} \
} \
- } MACRO_END
+ MACRO_END
#define ydec_single(stringiter, ret) \
- MACRO_BEGIN { \
+ MACRO_BEGIN \
int conv = STRING_ITERATOR_GET(stringiter); \
if (conv <= 0) { \
ret = -1; \
} else { \
- bool esc = false; \
if (conv == '=') { \
- esc = true; \
conv = STRING_ITERATOR_GET(stringiter); \
conv -= 64; \
} \
conv -= 42; \
ret = conv; \
} \
- } MACRO_END
+ MACRO_END
-TEST(yEncDec)
+TEST(yEnc, EncodeDecode)
{
for (int i = 0; i <= 255; ++i)
{
STRING_ITERATOR(fragmentiterator, fragment, 0);
ydec_single(fragmentiterator, encdec);
- TEST_Check(encdec == expect);
+ EXPECT_EQ(expect, encdec);
}
- TEST_OK();
+ SUCCEED();
}
-
-#endif