14a137b45SBram Moolenaar" Inserts 2 million lines with consecutive integers starting from 1 24a137b45SBram Moolenaar" (essentially, the output of GNU's seq 1 2000000), writes them to Xtest 34a137b45SBram Moolenaar" and writes its cksum to test.out. 44a137b45SBram Moolenaar" 54a137b45SBram Moolenaar" We need 2 million lines to trigger a call to mf_hash_grow(). If it would mess 64a137b45SBram Moolenaar" up the lines the checksum would differ. 74a137b45SBram Moolenaar" 84a137b45SBram Moolenaar" cksum is part of POSIX and so should be available on most Unixes. 94a137b45SBram Moolenaar" If it isn't available then the test will be skipped. 10*6d91bcb4SBram Moolenaar 11*6d91bcb4SBram Moolenaarsource check.vim 12*6d91bcb4SBram Moolenaar 134a137b45SBram Moolenaarfunc Test_File_Size() 14*6d91bcb4SBram Moolenaar CheckExecutable cksum 154a137b45SBram Moolenaar 164a137b45SBram Moolenaar new 1767418d97SBram Moolenaar set fileformat=unix undolevels=-1 184a137b45SBram Moolenaar for i in range(1, 2000000, 100) 194a137b45SBram Moolenaar call append(i, range(i, i + 99)) 204a137b45SBram Moolenaar endfor 214a137b45SBram Moolenaar 224a137b45SBram Moolenaar 1delete 234a137b45SBram Moolenaar w! Xtest 2407c043afSBram Moolenaar let res = systemlist('cksum Xtest')[0] 2507c043afSBram Moolenaar let res = substitute(res, "\r", "", "") 2607c043afSBram Moolenaar call assert_equal('3678979763 14888896 Xtest', res) 274a137b45SBram Moolenaar 284a137b45SBram Moolenaar enew! 294a137b45SBram Moolenaar call delete('Xtest') 3067418d97SBram Moolenaar set fileformat& undolevels& 314a137b45SBram Moolenaarendfunc 32db510071SBram Moolenaar 33db510071SBram Moolenaar" Test for writing and reading a file of over 100 Kbyte 34db510071SBram Moolenaarfunc Test_File_Read_Write() 35db510071SBram Moolenaar enew! 36db510071SBram Moolenaar 37db510071SBram Moolenaar " Create a file with the following contents 38db510071SBram Moolenaar " 1 line: "This is the start" 39db510071SBram Moolenaar " 3001 lines: "This is the leader" 40db510071SBram Moolenaar " 1 line: "This is the middle" 41db510071SBram Moolenaar " 3001 lines: "This is the trailer" 42db510071SBram Moolenaar " 1 line: "This is the end" 43db510071SBram Moolenaar call append(0, "This is the start") 44db510071SBram Moolenaar call append(1, repeat(["This is the leader"], 3001)) 45db510071SBram Moolenaar call append(3002, "This is the middle") 46db510071SBram Moolenaar call append(3003, repeat(["This is the trailer"], 3001)) 47db510071SBram Moolenaar call append(6004, "This is the end") 48db510071SBram Moolenaar 49db510071SBram Moolenaar write! Xtest 50db510071SBram Moolenaar enew! 51db510071SBram Moolenaar edit! Xtest 52db510071SBram Moolenaar 53db510071SBram Moolenaar call assert_equal("This is the start", getline(1)) 54db510071SBram Moolenaar call assert_equal("This is the middle", getline(3003)) 55db510071SBram Moolenaar call assert_equal("This is the end", getline(6005)) 56db510071SBram Moolenaar 57db510071SBram Moolenaar enew! 58db510071SBram Moolenaar call delete("Xtest") 59db510071SBram Moolenaarendfunc 60*6d91bcb4SBram Moolenaar 61*6d91bcb4SBram Moolenaar" vim: shiftwidth=2 sts=2 expandtab 62