Sha256: 1bf9387dfb6845160d092a540ed3a930adc99ad722773329a96fa51b0d358794

Contents?: true

Size: 1.53 KB

Versions: 10

Compression:

Stored size: 1.53 KB

Contents

require 'testhelper'

class ImageSniffing < Test::Unit::TestCase

  
  def test_cbmdos_dsk
    dsk=RipXplore.create_new(:CbmDos)
    test_string="Is this mike on?"
    
    test_file=dsk.add_file(:C64Prg,"TESTFILE.TXT",test_string)
    assert(test_file.kind_of?(NativeFileType),"add_file should return a subclass of NativeFileType (was #{test_file.class})")
    assert(test_file.kind_of?(C64Prg),"add_file should return a NativeFileType of appropriate subclass (was #{test_file.class})")
    assert(dsk.files[test_file.filename]!=nil,"dsk should have a file called #{test_file.filename}")
    assert_equal(test_file.contents,dsk.files[test_file.filename].contents)

    puts dsk.catalog
    #test we can write muliple files (this also tests we are correctly tracking sectors as being used)
    test_files=[]
    for i in 0..20
      t=dsk.add_file(:C64Prg,"TEST#{i}","TEST #{i} "+"*"*i*100)
      test_files<<t
    end    
    puts dsk.catalog
    for i in 0..20
    assert(dsk.files[test_files[i].filename]!=nil,"dsk should have a file called #{test_files[i].filename}")
      assert_equal(test_files[i].contents,dsk.files[test_files[i].filename].contents)
    end

  #make sure we can overwrite the same file (which also tests we are freeing sectors when files are deleted)
    for i in 0..250
      t=dsk.add_file(:C64Prg,"MULTICOPY","TEST #{i} "*50)
      assert_equal(t.contents,dsk.files[t.filename].contents)
    end     

    #save disk for later examination
    dsk.save_as("test_images/c64_write_test.dsk")
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ripxplore-0.17.1 test/tc_c64_write.rb
ripxplore-0.17.0 test/tc_c64_write.rb
ripxplore-0.16.1 test/tc_c64_write.rb
ripxplore-0.15.1 test/tc_c64_write.rb
ripxplore-0.14.1 test/tc_c64_write.rb
ripxplore-0.14.0 test/tc_c64_write.rb
ripxplore-0.13.0 test/tc_c64_write.rb
ripxplore-0.12.0 test/tc_c64_write.rb
ripxplore-0.11.0 test/tc_c64_write.rb
ripxplore-0.8.0 test/tc_c64_write.rb