# File test/tc_dos_disks.rb, line 27
  def test_write_to_dsk
    dsk=DSK.create_new(:dos33)
    test_file=TextFile.new("TESTFILE","Is this mike on?")
    dsk.add_file(test_file)
    assert(dsk.files[test_file.filename]!=nil,"dsk should have a file called #{test_file.filename}")
    assert_equal(test_file,dsk.files[test_file.filename])
    
    #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.make_file("TEST#{i}","TEST #{i} "+"*"*i*100)
      test_files<<t
      dsk.add_file(t)
    end    
    
    for i in 0..20
      assert_equal(test_files[i],dsk.files[test_files[i].filename])
    end
    
    #test we can make other file types
    [
      TextFile,
      BinaryFile,
      AppleSoftFile
    ].each do |file_class|
      test_file=file_class.new("TEST_"+file_class.to_s.upcase,"\FF"*256)
      dsk.add_file(test_file)
      assert_equal(test_file,dsk.files[test_file.filename])
    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.make_file("MULTICOPY","TEST #{i} ")      
      dsk.add_file(t)      
      assert_equal(t,dsk.files[t.filename])
    end     
    
    #check none of the above has clobbered our original 20 test files
    for i in 0..20
      assert_equal(test_files[i],dsk.files[test_files[i].filename])
    end
  
  #save disk for later examination
  dsk.save_as("dos_write_test.dsk")

  end