Skip to content
Snippets Groups Projects
Commit ebb7fd7d authored by Ruud Overeem's avatar Ruud Overeem
Browse files

Bug 1167: Cleaned up MAC layers. There are less dependancies between the packages now.

parent a295c4de
No related branches found
No related tags found
No related merge requests found
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
using namespace LOFAR; using namespace LOFAR;
using namespace std; using namespace std;
#define TOSTRING_TEST(type,min,max) \ #define TOSTRING_TEST(type,min,max) \
{ \ { \
cout << "min(" #type ") = " << toString(min) \ cout << "min(" #type ") = " << toString(min) \
...@@ -47,6 +46,11 @@ using namespace std; ...@@ -47,6 +46,11 @@ using namespace std;
<< toString(x, format) << endl; \ << toString(x, format) << endl; \
} }
#define DO_COMPACT_TEST(x) \
cout << (x) << " ==> " << compactedArrayString(x) << endl;
#define DO_EXPAND_TEST(x) \
cout << (x) << " ==> " << expandedArrayString(x) << endl;
bool testSplit() bool testSplit()
{ {
...@@ -172,6 +176,67 @@ bool testToString() ...@@ -172,6 +176,67 @@ bool testToString()
return true; return true;
} }
bool testCompactArray()
{
try {
DO_COMPACT_TEST("[ a,b,c ]");
DO_COMPACT_TEST("[ aa01,aa06 ]");
DO_COMPACT_TEST("[ aa01,aa02 ]");
DO_COMPACT_TEST("[ aa01,aa02,aa03 ]");
DO_COMPACT_TEST("[ aa01,aa02,aa03,aa04 ]");
DO_COMPACT_TEST("[ aa01,aa02,aa03,aa05 ]");
DO_COMPACT_TEST("[ aa01, aa02 ,aa03,aa05,aa06 ]");
DO_COMPACT_TEST("[ aa01, bb02 ,aa03,aa05,aa06 ]");
DO_COMPACT_TEST("[ aa01, aa02 ,aa0003,aa05,aa06 ]");
DO_COMPACT_TEST("[ aa01,aa02,aa03,aa05,aa06,aa7 ]");
DO_COMPACT_TEST("[ aa01,aa02,aa03,aa05,a06,aa7 ]");
DO_COMPACT_TEST("[ aa01,aa02,aa03,aa05,aaa06,aa7 ]");
DO_COMPACT_TEST("[22,23,24,25,30,31,33,35]");
DO_COMPACT_TEST("[22,23,24,25,30,31,33,35,36]");
DO_COMPACT_TEST("[22,23,24,25,30,31,33,35,36,37]");
DO_COMPACT_TEST("[22,23,24,25,30,31,33,35,36,37,37]");
DO_COMPACT_TEST("[22,23,24,25,30,31,33,35,36,37,40]");
DO_COMPACT_TEST("[22,23,23,25,30,31,30]");
DO_COMPACT_TEST("[22,23,23,25,30,31,30,31]");
DO_COMPACT_TEST("[22,23,23,25,30,31,30,31,31]");
DO_COMPACT_TEST("[22,23,23,23,23,23,25,30,31,30,31,31]");
} catch(Exception& e) {
LOG_ERROR_STR(e);
return (false);
}
return (true);
}
bool testExpandArray()
{
try {
DO_EXPAND_TEST("[ a,b,c ]");
DO_EXPAND_TEST("[ aa01,aa06 ]");
DO_EXPAND_TEST("[ aa01,aa02 ]");
DO_EXPAND_TEST("[ aa01..aa02 ]");
DO_EXPAND_TEST("[ aa01..aa03 ]");
DO_EXPAND_TEST("[ aa01..aa03,aa04 ]");
DO_EXPAND_TEST("[ aa01..aa03,aa05 ]");
DO_EXPAND_TEST("[ aa02,aa05..aa07]");
DO_EXPAND_TEST("[ aa02,aa05..aa04]");
DO_EXPAND_TEST("[ aa02,aa05..aa05]");
DO_EXPAND_TEST("[ aa01..ba03,aa05 ]");
DO_EXPAND_TEST("[ aa01..aa03,ba05 ]");
DO_EXPAND_TEST("[ aa01,ab03,aa05 ]");
DO_EXPAND_TEST("[ aa01,ab03..aa05 ]");
DO_EXPAND_TEST("[ aa01,aa03..ab05 ]");
DO_EXPAND_TEST("[ aa01,bb03..bb05 ]");
DO_EXPAND_TEST("[0..191]");
DO_EXPAND_TEST("[0,1,2,6,3,4,10..19,16]");
} catch(Exception& e) {
LOG_ERROR_STR(e);
return (false);
}
return (true);
}
int main() int main()
{ {
...@@ -183,7 +248,9 @@ int main() ...@@ -183,7 +248,9 @@ int main()
testCompare(true) && testCompare(true) &&
testTrim() && testTrim() &&
testCase() && testCase() &&
testToString(); testToString() &&
testCompactArray() &&
testExpandArray();
return (result ? 0 : 1); return (result ? 0 : 1);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment