Changeset f2d05e9 for tests/list
- Timestamp:
- May 12, 2020, 7:16:49 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 8d462e5
- Parents:
- 70ac8d0
- Location:
- tests/list
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/list/.expect/dlist-insert-remove.txt
r70ac8d0 rf2d05e9 1464 1464 0.7 1465 1465 - 1466 1467 ~~~~~~~~~~ End removal tests on Headed List: First ~~~~~~~~~~ 1468 1469 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1470 Test 16-i. Modifying Freds on MINE 1471 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1472 ==== fred by MINE before 1473 1.7 1474 2.7 1475 3.7 1476 - 1477 1.7 1478 - 1479 3.7 1480 - 1481 3.7 1482 2.7 1483 1.7 1484 - 1485 ==== fred by YOURS before 1486 1.7 1487 2.7 1488 3.7 1489 - 1490 1.7 1491 - 1492 3.7 1493 - 1494 3.7 1495 2.7 1496 1.7 1497 - 1498 ==== fred by MINE after 1499 2.7 1500 3.7 1501 - 1502 2.7 1503 - 1504 3.7 1505 - 1506 3.7 1507 2.7 1508 - 1509 ==== fred by YOURS after 1510 1.7 1511 2.7 1512 3.7 1513 - 1514 1.7 1515 - 1516 3.7 1517 - 1518 3.7 1519 2.7 1520 1.7 1521 - 1522 ==== fred by MINE after 1523 1.7 1524 - 1525 1.7 1526 - 1527 - 1528 - 1529 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1530 Test 16-ii. Modifying Freds on YOURS 1531 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1532 ==== fred by MINE before 1533 1.7 1534 2.7 1535 3.7 1536 - 1537 1.7 1538 - 1539 3.7 1540 - 1541 3.7 1542 2.7 1543 1.7 1544 - 1545 ==== fred by YOURS before 1546 1.7 1547 2.7 1548 3.7 1549 - 1550 1.7 1551 - 1552 3.7 1553 - 1554 3.7 1555 2.7 1556 1.7 1557 - 1558 ==== fred by MINE after 1559 1.7 1560 2.7 1561 3.7 1562 - 1563 1.7 1564 - 1565 3.7 1566 - 1567 3.7 1568 2.7 1569 1.7 1570 - 1571 ==== fred by YOURS after 1572 2.7 1573 3.7 1574 - 1575 2.7 1576 - 1577 3.7 1578 - 1579 3.7 1580 2.7 1581 - 1582 ==== fred by YOURS after 1583 1.7 1584 - 1585 1.7 1586 - 1587 - 1588 - 1589 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1590 Test 16-iii. Modifying Maries 1591 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1592 ==== mary before 1593 1.7 1594 2.7 1595 3.7 1596 - 1597 1.7 1598 - 1599 3.7 1600 - 1601 3.7 1602 2.7 1603 1.7 1604 - 1605 ==== mary after 1606 2.7 1607 3.7 1608 - 1609 2.7 1610 - 1611 3.7 1612 - 1613 3.7 1614 2.7 1615 - 1616 ==== mary after 1617 1.7 1618 - 1619 1.7 1620 - 1621 - 1622 - 1623 1624 ~~~~~~~~~~ End removal tests on Headed List: Last ~~~~~~~~~~ 1625 1626 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1627 Test 17-i. Modifying Freds on MINE 1628 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1629 ==== fred by MINE before 1630 1.7 1631 2.7 1632 3.7 1633 - 1634 1.7 1635 - 1636 3.7 1637 - 1638 3.7 1639 2.7 1640 1.7 1641 - 1642 ==== fred by YOURS before 1643 1.7 1644 2.7 1645 3.7 1646 - 1647 1.7 1648 - 1649 3.7 1650 - 1651 3.7 1652 2.7 1653 1.7 1654 - 1655 ==== fred by MINE after 1656 1.7 1657 2.7 1658 - 1659 1.7 1660 - 1661 2.7 1662 - 1663 2.7 1664 1.7 1665 - 1666 ==== fred by YOURS after 1667 1.7 1668 2.7 1669 3.7 1670 - 1671 1.7 1672 - 1673 3.7 1674 - 1675 3.7 1676 2.7 1677 1.7 1678 - 1679 ==== fred by MINE after 1680 3.7 1681 - 1682 3.7 1683 - 1684 - 1685 - 1686 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1687 Test 17-ii. Modifying Freds on YOURS 1688 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1689 ==== fred by MINE before 1690 1.7 1691 2.7 1692 3.7 1693 - 1694 1.7 1695 - 1696 3.7 1697 - 1698 3.7 1699 2.7 1700 1.7 1701 - 1702 ==== fred by YOURS before 1703 1.7 1704 2.7 1705 3.7 1706 - 1707 1.7 1708 - 1709 3.7 1710 - 1711 3.7 1712 2.7 1713 1.7 1714 - 1715 ==== fred by MINE after 1716 1.7 1717 2.7 1718 3.7 1719 - 1720 1.7 1721 - 1722 3.7 1723 - 1724 3.7 1725 2.7 1726 1.7 1727 - 1728 ==== fred by YOURS after 1729 1.7 1730 2.7 1731 - 1732 1.7 1733 - 1734 2.7 1735 - 1736 2.7 1737 1.7 1738 - 1739 ==== fred by YOURS after 1740 3.7 1741 - 1742 3.7 1743 - 1744 - 1745 - 1746 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1747 Test 17-iii. Modifying Maries 1748 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1749 ==== mary before 1750 1.7 1751 2.7 1752 3.7 1753 - 1754 1.7 1755 - 1756 3.7 1757 - 1758 3.7 1759 2.7 1760 1.7 1761 - 1762 ==== mary after 1763 1.7 1764 2.7 1765 - 1766 1.7 1767 - 1768 2.7 1769 - 1770 2.7 1771 1.7 1772 - 1773 ==== mary after 1774 3.7 1775 - 1776 3.7 1777 - 1778 - 1779 - -
tests/list/dlist-insert-remove.cfa
r70ac8d0 rf2d05e9 1187 1187 //////////////////////////////////////////////////////////// 1188 1188 // 1189 // Section 4f 1190 // 1191 // Test cases of pop_first, pop_last 1192 // 1193 // Example of call-side user code 1194 // 1195 //////////////////////////////////////////////////////////// 1196 1197 // These cases assume element removal at first-last is correct 1198 1199 void test__pop_first__fred_mine() { 1200 1201 fred f1 = {1.7}; 1202 fred f2 = {2.7}; 1203 fred f3 = {3.7}; 1204 1205 dlist(fred_in_mine, fred) flm; 1206 insert_last(flm, f1); 1207 insert_last(flm, f2); 1208 insert_last(flm, f3); 1209 1210 dlist(fred_in_yours, fred) fly; 1211 insert_last(fly, f1); 1212 insert_last(fly, f2); 1213 insert_last(fly, f3); 1214 1215 printMyFreddies(flm`first, flm`last, 1); // 1.7, 2.7, 3.7; 1.7; 3.7; 3.7, 2.7, 1.7 1216 printYourFreddies(fly`first, fly`last, 1); // 1.7, 2.7, 3.7; 1.7; 3.7; 3.7, 2.7, 1.7 1217 1218 verify(validate(fly)); 1219 verify(validate(flm)); 1220 1221 fred & popped = pop_first(flm); 1222 1223 verify(validate(fly)); 1224 verify(validate(flm)); 1225 1226 printMyFreddies(flm`first, flm`last, 0); // 2.7, 3.7; 2.7; 3.7; 3.7, 2.7 (modified) 1227 printYourFreddies(fly`first, fly`last, 0); // 1.7, 2.7, 3.7; 1.7; 3.7; 3.7, 2.7, 1.7 (unmodified) 1228 1229 // observe f1 is now solo in mine; in yours, it was just traversed 1230 printMyFreddies(f1, *0p, 0); // 1.7; 1.7; ; 1231 1232 assert( &popped == & f1 ); 1233 } 1234 1235 void test__pop_first__fred_yours() { 1236 1237 fred f1 = {1.7}; 1238 fred f2 = {2.7}; 1239 fred f3 = {3.7}; 1240 1241 dlist(fred_in_mine, fred) flm; 1242 insert_last(flm, f1); 1243 insert_last(flm, f2); 1244 insert_last(flm, f3); 1245 1246 dlist(fred_in_yours, fred) fly; 1247 insert_last(fly, f1); 1248 insert_last(fly, f2); 1249 insert_last(fly, f3); 1250 1251 printMyFreddies(flm`first, flm`last, 1); // 1.7, 2.7, 3.7; 1.7; 3.7; 3.7, 2.7, 1.7 1252 printYourFreddies(fly`first, fly`last, 1); // 1.7, 2.7, 3.7; 1.7; 3.7; 3.7, 2.7, 1.7 1253 1254 verify(validate(fly)); 1255 verify(validate(flm)); 1256 1257 fred & popped = pop_first(fly); 1258 1259 verify(validate(fly)); 1260 verify(validate(flm)); 1261 1262 printMyFreddies(flm`first, flm`last, 0); // 1.7, 2.7, 3.7; 1.7; 3.7; 3.7, 2.7, 1.7 (unmodified) 1263 printYourFreddies(fly`first, fly`last, 0); // 2.7, 3.7; 2.7; 3.7; 3.7, 2.7 (modified) 1264 1265 // observe f1 is now solo in yours; in mine, it was just traversed 1266 printYourFreddies(f1, *0p, 0); // 1.7; 1.7; ; 1267 1268 assert( &popped == &f1 ); 1269 } 1270 1271 void test__pop_first__maries() { 1272 1273 mary m1 = {1.7}; 1274 mary m2 = {2.7}; 1275 mary m3 = {3.7}; 1276 1277 dlist(mary, mary) ml; 1278 insert_last(ml, m1); 1279 insert_last(ml, m2); 1280 insert_last(ml, m3); 1281 1282 printMariatheotokos(ml`first, ml`last, 1); // 1.7, 2.7, 3.7; 1.7; 3.7; 3.7, 2.7, 1.7 1283 1284 verify(validate(ml)); 1285 1286 mary & popped = pop_first(ml); 1287 1288 verify(validate(ml)); 1289 1290 printMariatheotokos(ml`first, ml`last, 0); // 2.7, 3.7; 2.7; 3.7; 3.7, 2.7 (modified) 1291 1292 // observe m1 is now solo 1293 printMariatheotokos(m1, *0p, 0); // 1.7; 1.7; ; 1294 1295 assert( &popped == &m1 ); 1296 } 1297 1298 void test__pop_last__fred_mine() { 1299 1300 fred f1 = {1.7}; 1301 fred f2 = {2.7}; 1302 fred f3 = {3.7}; 1303 1304 dlist(fred_in_mine, fred) flm; 1305 insert_last(flm, f1); 1306 insert_last(flm, f2); 1307 insert_last(flm, f3); 1308 1309 dlist(fred_in_yours, fred) fly; 1310 insert_last(fly, f1); 1311 insert_last(fly, f2); 1312 insert_last(fly, f3); 1313 1314 printMyFreddies(flm`first, flm`last, 1); // 1.7, 2.7, 3.7; 1.7; 3.7; 3.7, 2.7, 1.7 1315 printYourFreddies(fly`first, fly`last, 1); // 1.7, 2.7, 3.7; 1.7; 3.7; 3.7, 2.7, 1.7 1316 1317 verify(validate(fly)); 1318 verify(validate(flm)); 1319 1320 fred & popped = pop_last(flm); 1321 1322 verify(validate(fly)); 1323 verify(validate(flm)); 1324 1325 printMyFreddies(flm`first, flm`last, 0); // 1.7, 2.7; 1.7; 2.7; 2.7, 1.7 (modified) 1326 printYourFreddies(fly`first, fly`last, 0); // 1.7, 2.7, 3.7; 1.7; 3.7; 3.7, 2.7, 1.7 (unmodified) 1327 1328 // observe f3 is now solo in mine; in yours, it was just traversed 1329 printMyFreddies(f3, *0p, 0); // 3.7; 3.7; ; 1330 1331 assert( &popped == & f3 ); 1332 } 1333 1334 void test__pop_last__fred_yours() { 1335 1336 fred f1 = {1.7}; 1337 fred f2 = {2.7}; 1338 fred f3 = {3.7}; 1339 1340 dlist(fred_in_mine, fred) flm; 1341 insert_last(flm, f1); 1342 insert_last(flm, f2); 1343 insert_last(flm, f3); 1344 1345 dlist(fred_in_yours, fred) fly; 1346 insert_last(fly, f1); 1347 insert_last(fly, f2); 1348 insert_last(fly, f3); 1349 1350 printMyFreddies(flm`first, flm`last, 1); // 1.7, 2.7, 3.7; 1.7; 3.7; 3.7, 2.7, 1.7 1351 printYourFreddies(fly`first, fly`last, 1); // 1.7, 2.7, 3.7; 1.7; 3.7; 3.7, 2.7, 1.7 1352 1353 verify(validate(fly)); 1354 verify(validate(flm)); 1355 1356 fred & popped = pop_last(fly); 1357 1358 verify(validate(fly)); 1359 verify(validate(flm)); 1360 1361 printMyFreddies(flm`first, flm`last, 0); // 1.7, 2.7, 3.7; 1.7; 3.7; 3.7, 2.7, 1.7 (unmodified) 1362 printYourFreddies(fly`first, fly`last, 0); // 1.7, 2.7; 1.7; 2.7; 2.7, 1.7 (modified) 1363 1364 // observe f3 is now solo in yours; in mine, it was just traversed 1365 printYourFreddies(f3, *0p, 0); // 3.7; 3.7; ; 1366 1367 assert( &popped == & f3 ); 1368 } 1369 1370 void test__pop_last__maries() { 1371 1372 mary m1 = {1.7}; 1373 mary m2 = {2.7}; 1374 mary m3 = {3.7}; 1375 1376 dlist(mary, mary) ml; 1377 insert_last(ml, m1); 1378 insert_last(ml, m2); 1379 insert_last(ml, m3); 1380 1381 printMariatheotokos(ml`first, ml`last, 1); // 1.7, 2.7, 3.7; 1.7; 3.7; 3.7, 2.7, 1.7 1382 1383 verify(validate(ml)); 1384 1385 mary & popped = pop_last(ml); 1386 1387 verify(validate(ml)); 1388 1389 printMariatheotokos(ml`first, ml`last, 0); // 1.7, 1.7; 1.7; 2.7; 2.7, 1.7 (modified) 1390 1391 // observe m1 is now solo 1392 printMariatheotokos(m3, *0p, 0); // 3.7; 3.7; ; 1393 1394 assert( &popped == &m3 ); 1395 } 1396 1397 //////////////////////////////////////////////////////////// 1398 // 1189 1399 // Section 5 1190 1400 // … … 1422 1632 test__remove_of_sole__mary(); 1423 1633 1634 sout | ""; 1635 sout | "~~~~~~~~~~ End removal tests on Headed List: First ~~~~~~~~~~"; 1636 sout | ""; 1637 1638 sout | "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; 1639 sout | "Test 16-i. Modifying Freds on MINE"; 1640 sout | "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; 1641 test__pop_first__fred_mine(); 1642 1643 sout | "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; 1644 sout | "Test 16-ii. Modifying Freds on YOURS"; 1645 sout | "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; 1646 test__pop_first__fred_yours(); 1647 1648 sout | "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; 1649 sout | "Test 16-iii. Modifying Maries"; 1650 sout | "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; 1651 test__pop_first__maries(); 1652 1653 sout | ""; 1654 sout | "~~~~~~~~~~ End removal tests on Headed List: Last ~~~~~~~~~~"; 1655 sout | ""; 1656 1657 sout | "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; 1658 sout | "Test 17-i. Modifying Freds on MINE"; 1659 sout | "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; 1660 test__pop_last__fred_mine(); 1661 1662 sout | "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; 1663 sout | "Test 17-ii. Modifying Freds on YOURS"; 1664 sout | "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; 1665 test__pop_last__fred_yours(); 1666 1667 sout | "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; 1668 sout | "Test 17-iii. Modifying Maries"; 1669 sout | "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; 1670 test__pop_last__maries(); 1671 1424 1672 return 0; 1425 1673 }
Note: See TracChangeset
for help on using the changeset viewer.