899 for(
uint32 i = 0; i < 12; ++i)
901 final_case[i] =
false;
904 for(
uint32 run = 0; run < 2; ++run)
913 for(
uint32 i = 0; i < test_size; ++i)
921 for(
uint32 i = 0; i < test_size * 5 + 7; ++i)
928 for(
uint32 i = 0; i < test_size; ++i)
936 for(
uint32 i = 0; i < test_size * 5 + 7; ++i)
947 uint32 offset_end = a_length + test_size * 6 + 7;
949 for(
uint32 n_samples = 0; n_samples < offset_end; ++n_samples)
951 for(
uint32 offset = 0; offset < offset_end; ++offset)
953 bool current_run[12];
955 for(
uint32 i = 0; i < 12; ++i)
957 current_run[i] =
false;
961 result.add(b,offset,n_samples);
963 uint32 result_length = result.getLength();
971 if(n_samples == 0 && a_length < offset)
973 current_run[0] =
true;
976 if(result_length != offset + b_length)
979 n_samples, offset, a_length, b_length,
980 "result length error");
984 for(
uint32 i = 0; i < a_length; ++i)
989 n_samples, offset, a_length, b_length,
990 "result prefix error");
995 for(
uint32 i = a_length + 1; i < offset; ++i)
1000 n_samples, offset, a_length, b_length,
1001 "result gap error");
1006 for(
uint32 i = offset + 1; i < result_length; ++i)
1008 if(result[i] != 1.0)
1011 n_samples, offset, a_length, b_length,
1012 "result b value error");
1027 else if(n_samples != 0
1028 && a_length < offset
1029 && n_samples <= b_length)
1031 current_run[1] =
true;
1033 if(result_length != offset + n_samples)
1036 n_samples, offset, a_length, b_length,
1037 "result length error");
1041 for(
uint32 i = 0; i < a_length; ++i)
1043 if(result[i] != 1.0)
1046 n_samples, offset, a_length, b_length,
1047 "result prefix error");
1052 for(
uint32 i = a_length + 1; i < offset; ++i)
1054 if(result[i] != 0.0)
1057 n_samples, offset, a_length, b_length,
1058 "result gap error");
1063 for(
uint32 i = offset + 1; i < result_length; ++i)
1065 if(result[i] != 1.0)
1068 n_samples, offset, a_length, b_length,
1069 "result b value error");
1084 else if(n_samples != 0
1085 && a_length < offset
1086 && n_samples > b_length)
1088 current_run[2] =
true;
1091 if(result_length != offset + n_samples)
1094 n_samples, offset, a_length, b_length,
1095 "result length error");
1099 for(
uint32 i = 0; i < a_length; ++i)
1101 if(result[i] != 1.0)
1104 n_samples, offset, a_length, b_length,
1105 "result prefix error");
1110 for(
uint32 i = a_length + 1; i < offset; ++i)
1112 if(result[i] != 0.0)
1115 n_samples, offset, a_length, b_length,
1116 "result gap error");
1121 for(
uint32 i = offset + 1; i < offset + b_length; ++i)
1123 if(result[i] != 1.0)
1126 n_samples, offset, a_length, b_length,
1127 "result b value error");
1132 for(
uint32 i = offset + b_length + 1; i < result_length; ++i)
1134 if(result[i] != 0.0)
1137 n_samples, offset, a_length, b_length,
1138 "result tail error");
1152 else if(n_samples == 0
1153 && a_length >= offset
1154 && a_length < offset + b_length)
1156 current_run[3] =
true;
1159 if(result_length != offset + b_length)
1162 n_samples, offset, a_length, b_length,
1163 "result length error");
1167 for(
uint32 i = 0; i < offset; ++i)
1169 if(result[i] != 1.0)
1172 n_samples, offset, a_length, b_length,
1173 "result prefix error");
1178 for(
uint32 i = offset + 1; i < a_length; ++i)
1180 if(result[i] != 2.0)
1183 n_samples, offset, a_length, b_length,
1184 "result overlap error");
1189 for(
uint32 i = a_length + 1; i < result_length; ++i)
1191 if(result[i] != 1.0)
1194 n_samples, offset, a_length, b_length,
1195 "result tail error");
1211 else if(n_samples != 0
1212 && a_length >= offset
1213 && a_length <= offset + n_samples
1214 && n_samples <= b_length)
1216 current_run[4] =
true;
1219 if(result_length != offset + n_samples)
1222 n_samples, offset, a_length, b_length,
1223 "result length error");
1227 for(
uint32 i = 0; i < offset; ++i)
1229 if(result[i] != 1.0)
1232 n_samples, offset, a_length, b_length,
1233 "result prefix error");
1238 for(
uint32 i = offset + 1; i < a_length; ++i)
1240 if(result[i] != 2.0)
1243 n_samples, offset, a_length, b_length,
1244 "result overlap error");
1249 for(
uint32 i = a_length + 1; i < result_length; ++i)
1251 if(result[i] != 1.0)
1254 n_samples, offset, a_length, b_length,
1255 "result tail error");
1270 else if(n_samples != 0
1271 && a_length >= offset
1272 && a_length > offset + n_samples
1273 && n_samples < b_length)
1275 current_run[5] =
true;
1278 if(result_length != a_length)
1281 n_samples, offset, a_length, b_length,
1282 "result length error");
1286 for(
uint32 i = 0; i < offset; ++i)
1288 if(result[i] != 1.0)
1291 n_samples, offset, a_length, b_length,
1292 "result prefix error");
1297 for(
uint32 i = offset + 1; i < offset + n_samples; ++i)
1299 if(result[i] != 2.0)
1302 n_samples, offset, a_length, b_length,
1303 "result overlap error");
1308 for(
uint32 i = a_length + 1; i < result_length; ++i)
1310 if(result[i] != 1.0)
1313 n_samples, offset, a_length, b_length,
1314 "result tail error");
1329 else if(n_samples != 0
1330 && a_length >= offset
1331 && a_length <= offset + b_length
1332 && n_samples > b_length)
1334 current_run[6] =
true;
1337 if(result_length != offset + n_samples)
1340 n_samples, offset, a_length, b_length,
1341 "result length error");
1345 for(
uint32 i = 0; i < offset; ++i)
1347 if(result[i] != 1.0)
1350 n_samples, offset, a_length, b_length,
1351 "result prefix error");
1356 for(
uint32 i = offset + 1; i < a_length; ++i)
1358 if(result[i] != 2.0)
1361 n_samples, offset, a_length, b_length,
1362 "result overlap error");
1367 for(
uint32 i = a_length + 1; i < offset + b_length; ++i)
1369 if(result[i] != 1.0)
1372 n_samples, offset, a_length, b_length,
1373 "result b value error");
1378 for(
uint32 i = offset + b_length + 1; i < result_length; ++i)
1380 if(result[i] != 0.0)
1383 n_samples, offset, a_length, b_length,
1384 "result tail error");
1396 else if(n_samples == 0
1397 && a_length >= offset + b_length)
1399 current_run[7] =
true;
1402 if(result_length != a_length)
1405 n_samples, offset, a_length, b_length,
1406 "result length error");
1410 for(
uint32 i = 0; i < offset; ++i)
1412 if(result[i] != 1.0)
1415 n_samples, offset, a_length, b_length,
1416 "result prefix error");
1421 for(
uint32 i = offset + 1; i < offset + b_length; ++i)
1423 if(result[i] != 2.0)
1426 n_samples, offset, a_length, b_length,
1427 "result overlap error");
1432 for(
uint32 i = offset + b_length + 1; i < result_length; ++i)
1434 if(result[i] != 1.0)
1437 n_samples, offset, a_length, b_length,
1438 "result a value error");
1452 else if(n_samples != 0
1453 && a_length >= offset + n_samples
1454 && n_samples < b_length)
1456 current_run[8] =
true;
1459 if(result_length != a_length)
1462 n_samples, offset, a_length, b_length,
1463 "result length error");
1467 for(
uint32 i = 0; i < offset; ++i)
1469 if(result[i] != 1.0)
1472 n_samples, offset, a_length, b_length,
1473 "result prefix error");
1478 for(
uint32 i = offset + 1; i < offset + n_samples; ++i)
1480 if(result[i] != 2.0)
1483 n_samples, offset, a_length, b_length,
1484 "result overlap error");
1489 for(
uint32 i = offset + n_samples + 1; i < result_length; ++i)
1491 if(result[i] != 1.0)
1494 n_samples, offset, a_length, b_length,
1495 "result a value error");
1509 else if(n_samples != 0
1510 && a_length >= offset + n_samples
1511 && n_samples >= b_length)
1513 current_run[9] =
true;
1516 if(result_length != a_length)
1519 n_samples, offset, a_length, b_length,
1520 "result length error");
1524 for(
uint32 i = 0; i < offset; ++i)
1526 if(result[i] != 1.0)
1529 n_samples, offset, a_length, b_length,
1530 "result prefix error");
1535 for(
uint32 i = offset + 1; i < offset + b_length; ++i)
1537 if(result[i] != 2.0)
1540 n_samples, offset, a_length, b_length,
1541 "result overlap error");
1546 for(
uint32 i = offset + b_length + 1; i < result_length; ++i)
1548 if(result[i] != 1.0)
1551 result.plot(
"result");
1554 n_samples, offset, a_length, b_length,
1555 "result a value error");
1569 else if(n_samples != 0
1570 && a_length > offset + b_length
1571 && a_length < offset + n_samples)
1573 current_run[10] =
true;
1576 if(result_length != offset + n_samples)
1579 n_samples, offset, a_length, b_length,
1580 "result length error");
1584 for(
uint32 i = 0; i < offset; ++i)
1586 if(result[i] != 1.0)
1589 n_samples, offset, a_length, b_length,
1590 "result prefix error");
1595 for(
uint32 i = offset + 1; i < offset + b_length; ++i)
1597 if(result[i] != 2.0)
1600 n_samples, offset, a_length, b_length,
1601 "result overlap error");
1606 for(
uint32 i = offset + b_length + 1; i < a_length; ++i)
1608 if(result[i] != 1.0)
1611 n_samples, offset, a_length, b_length,
1612 "result a value error");
1617 for(
uint32 i = a_length + 1; i < result_length; ++i)
1619 if(result[i] != 0.0)
1622 n_samples, offset, a_length, b_length,
1623 "result tail error");
1640 for(
uint32 i = 0; i < 11; ++i)
1643 final_case[i] =
true;
1649 cout <<
"cases not hit: ";
1651 for(
uint32 i = 0; i < 11; ++i)
1654 cout << i + 1 <<
" ";
void reportError(const std::string &filename, unsigned int line_number, unsigned int n_samples, unsigned int offset, unsigned int a_length, unsigned int b_length, const std::string &message)
void plot(const std::string &title="Buffer") const
Requires matplotlib. Creates a plot of this Buffer.
uint32 getLength() const
Returns the number of samples in the Buffer.
A Buffer for storing audio samples.