Commit 3608eac7 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Added lots of test cases for l2g_write.

parent ce316bfb
......@@ -31,6 +31,9 @@ l2g_send "a0 933 95724"
l2g_send "a0 948 97085"
l2g_send "a0 992 97960"
l2g_send "w0"
simple_expect "\\\[993 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 445:77697 474:78372 482:79436 539:80907 602:84499 612:87035 618:87514 688:88856 792:89215 849:92418 922:93794,94866 933:95724 948:97085 992:97960\\\]"
# Insert 25 numbers in the range 1001..1025, simulating newly created
# texts.
l2g_send "a0 1001 101613"
......@@ -59,6 +62,9 @@ l2g_send "a0 1023 117278"
l2g_send "a0 1024 117886"
l2g_send "a0 1025 119385"
l2g_send "w0"
simple_expect "\\\[1026 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 445:77697 474:78372 482:79436 539:80907 602:84499 612:87035 618:87514 688:88856 792:89215 849:92418 922:93794,94866 933:95724 948:97085 992:97960 1001:101613,102864,103254,103935,104444,105551,105859,106390,106784,107002,107212,107324,107469,107571,108471,108592,109959,111141,111225,113738,116365,117110,117278,117886,119385\\\]"
# Check that we've got three sparse blocks and two dense. All of them
# are optimally packed.
l2g_send "u0"
......@@ -87,6 +93,9 @@ simple_expect "2: 10 0 922 \\(sparse\\) \\\[922:93794 923:94866 933:95724 948:97
simple_expect "3: 10 0 1006 \\(dense\\) \\\[105551 105859 106390 106784 107002 107212 107324 107469 107571 108471 \\\]"
simple_expect "4: 10 0 1016 \\(dense\\) \\\[108592 109959 111141 111225 113738 116365 117110 117278 117886 119385 \\\]"
l2g_send "w0"
simple_expect "\\\[1026 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 474:78372 539:80907 618:87514 688:88856 792:89215 922:93794,94866 933:95724 948:97085 992:97960 1001:101613,102864,103254,103935,104444,105551,105859,106390,106784,107002,107212,107324,107469,107571,108471,108592,109959,111141,111225,113738,116365,117110,117278,117886,119385\\\]"
# Delete one more item and ensure that it is compacted.
l2g_send "d0 539"
l2g_send "u0"
......@@ -98,6 +107,9 @@ simple_expect "2: 10 0 922 \\(sparse\\) \\\[922:93794 923:94866 933:95724 948:97
simple_expect "3: 10 0 1006 \\(dense\\) \\\[105551 105859 106390 106784 107002 107212 107324 107469 107571 108471 \\\]"
simple_expect "4: 10 0 1016 \\(dense\\) \\\[108592 109959 111141 111225 113738 116365 117110 117278 117886 119385 \\\]"
l2g_send "w0"
simple_expect "\\\[1026 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 474:78372 618:87514 688:88856 792:89215 922:93794,94866 933:95724 948:97085 992:97960 1001:101613,102864,103254,103935,104444,105551,105859,106390,106784,107002,107212,107324,107469,107571,108471,108592,109959,111141,111225,113738,116365,117110,117278,117886,119385\\\]"
# Check that lookup of 445..474 works properly.
l2g_send "l0 444"
simple_expect "0"
......@@ -183,6 +195,9 @@ simple_expect "2: 10 3 922 \\(sparse\\) \\\[922:93794 923:0 933:95724 948:97085
simple_expect "3: 10 0 1006 \\(dense\\) \\\[105551 105859 106390 106784 107002 107212 107324 107469 107571 108471 \\\]"
simple_expect "4: 10 0 1016 \\(dense\\) \\\[108592 109959 111141 111225 113738 116365 117110 117278 117886 119385 \\\]"
l2g_send "w0"
simple_expect "\\\[1026 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 474:78372 618:87514 688:88856 792:89215 922:93794 933:95724 948:97085 992:97960 1003:103254,103935,104444,105551,105859,106390,106784,107002,107212,107324,107469,107571,108471,108592,109959,111141,111225,113738,116365,117110,117278,117886,119385\\\]"
# Remove one more item from block 2 and watch it merge with block 1.
l2g_send "d0 1003"
l2g_send "u0"
......@@ -193,17 +208,40 @@ simple_expect "1: 10 0 445 \\(sparse\\) \\\[474:78372 618:87514 688:88856 792:89
simple_expect "2: 10 0 1006 \\(dense\\) \\\[105551 105859 106390 106784 107002 107212 107324 107469 107571 108471 \\\]"
simple_expect "3: 10 0 1016 \\(dense\\) \\\[108592 109959 111141 111225 113738 116365 117110 117278 117886 119385 \\\]"
l2g_send "w0"
simple_expect "\\\[1026 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 474:78372 618:87514 688:88856 792:89215 922:93794 933:95724 948:97085 992:97960 1004:103935,104444,105551,105859,106390,106784,107002,107212,107324,107469,107571,108471,108592,109959,111141,111225,113738,116365,117110,117278,117886,119385\\\]"
# Remove all but one item from the current block 2 (simualting a
# massive garb effort).
l2g_send "d0 1006"
l2g_send "w0"
simple_expect "\\\[1026 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 474:78372 618:87514 688:88856 792:89215 922:93794 933:95724 948:97085 992:97960 1004:103935,104444,0,105859,106390,106784,107002,107212,107324,107469,107571,108471,108592,109959,111141,111225,113738,116365,117110,117278,117886,119385\\\]"
l2g_send "d0 1007"
l2g_send "w0"
simple_expect "\\\[1026 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 474:78372 618:87514 688:88856 792:89215 922:93794 933:95724 948:97085 992:97960 1004:103935,104444,0,0,106390,106784,107002,107212,107324,107469,107571,108471,108592,109959,111141,111225,113738,116365,117110,117278,117886,119385\\\]"
l2g_send "d0 1008"
l2g_send "w0"
simple_expect "\\\[1026 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 474:78372 618:87514 688:88856 792:89215 922:93794 933:95724 948:97085 992:97960 1004:103935,104444 1009:106784,107002,107212,107324,107469,107571,108471,108592,109959,111141,111225,113738,116365,117110,117278,117886,119385\\\]"
l2g_send "d0 1009"
l2g_send "w0"
simple_expect "\\\[1026 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 474:78372 618:87514 688:88856 792:89215 922:93794 933:95724 948:97085 992:97960 1004:103935,104444 1010:107002,107212,107324,107469,107571,108471,108592,109959,111141,111225,113738,116365,117110,117278,117886,119385\\\]"
l2g_send "d0 1010"
l2g_send "d0 1011"
l2g_send "d0 1012"
l2g_send "d0 1013"
l2g_send "d0 1014"
l2g_send "w0"
simple_expect "\\\[1026 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 474:78372 618:87514 688:88856 792:89215 922:93794 933:95724 948:97085 992:97960 1004:103935,104444 1015:108471,108592,109959,111141,111225,113738,116365,117110,117278,117886,119385\\\]"
# Delete a nonexisting text that would have been present in a dense block.
l2g_send "d0 1012"
l2g_send "u0"
......@@ -238,6 +276,9 @@ simple_expect "0: 10 0 35 \\(sparse\\) \\\[35:53428 50:57456 222:59570 259:70441
simple_expect "1: 10 0 445 \\(sparse\\) \\\[474:78372 618:87514 688:88856 792:89215 922:93794 933:95724 948:97085 992:97960 1004:103935 1005:104444 \\\]"
simple_expect "2: 10 0 1016 \\(dense\\) \\\[108592 109959 111141 111225 113738 116365 117110 117278 117886 119385 \\\]"
l2g_send "w0"
simple_expect "\\\[1026 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 474:78372 618:87514 688:88856 792:89215 922:93794 933:95724 948:97085 992:97960 1004:103935,104444 1016:108592,109959,111141,111225,113738,116365,117110,117278,117886,119385\\\]"
# Insert one and a half new blocks.
l2g_send "a0 1026 120115"
l2g_send "a0 1027 122073"
......@@ -263,12 +304,23 @@ simple_expect "2: 10 0 1016 \\(dense\\) \\\[108592 109959 111141 111225 113738 1
simple_expect "3: 10 0 1026 \\(dense\\) \\\[120115 122073 123273 125065 125444 125537 127933 128542 129196 129907 \\\]"
simple_expect "4: 5 5 1036 \\(dense\\) \\\[130515 131081 131308 132341 134218 \\\]"
l2g_send "w0"
simple_expect "\\\[1041 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 474:78372 618:87514 688:88856 792:89215 922:93794 933:95724 948:97085 992:97960 1004:103935,104444 1016:108592,109959,111141,111225,113738,116365,117110,117278,117886,119385,120115,122073,123273,125065,125444,125537,127933,128542,129196,129907,130515,131081,131308,132341,134218\\\]"
# Remove a few text from block 3 and 2, but not enough to matter.
l2g_send "d0 1027"
l2g_send "d0 1028"
l2g_send "d0 1017"
l2g_send "d0 1018"
l2g_send "w0"
simple_expect "\\\[1041 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 474:78372 618:87514 688:88856 792:89215 922:93794 933:95724 948:97085 992:97960 1004:103935,104444 1016:108592,0,0,111225,113738,116365,117110,117278,117886,119385,120115,0,0,125065,125444,125537,127933,128542,129196,129907,130515,131081,131308,132341,134218\\\]"
l2g_send "d0 1029"
l2g_send "w0"
simple_expect "\\\[1041 35:53428 50:57456 222:59570 259:70441 304:72037 329:72239 358:72910 383:73113 389:73612 395:76393 474:78372 618:87514 688:88856 792:89215 922:93794 933:95724 948:97085 992:97960 1004:103935,104444 1016:108592,0,0,111225,113738,116365,117110,117278,117886,119385,120115 1030:125444,125537,127933,128542,129196,129907,130515,131081,131308,132341,134218\\\]"
l2g_send "u0"
simple_expect "Number of blocks: 5"
simple_expect "First unused: 1041"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment