Решение на Трета задача от Иван Кавалджиев
Обратно към всички решения
Към профила на Иван Кавалджиев
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 30 успешни тест(а)
- 14 неуспешни тест(а)
Код
Лог от изпълнението
.F..F...FFFFFFFFFF......F...F...............
Failures:
1) RBFS Directory can create empty directory
Failure/Error: directory.add_directory 'home'
ArgumentError:
wrong number of arguments (1 for 2)
# /tmp/d20141111-26053-3ns4c2/solution.rb:59:in `add_directory'
# /tmp/d20141111-26053-3ns4c2/spec.rb:150:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
2) RBFS Directory without files can be serialized
Failure/Error: expect(directory.serialize).to eq '0:0:'
NoMethodError:
undefined method `serialize' for #<RBFS::Directory:0xb9d661b8 @directory={}>
# /tmp/d20141111-26053-3ns4c2/spec.rb:11:in `block (4 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
3) RBFS Directory serialization #serialize can serialize
Failure/Error: directory.add_directory 'rbfs'
ArgumentError:
wrong number of arguments (1 for 2)
# /tmp/d20141111-26053-3ns4c2/solution.rb:59:in `add_directory'
# /tmp/d20141111-26053-3ns4c2/spec.rb:79:in `block (5 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
4) RBFS Directory serialization #serialize can serialize multiple directories recursively
Failure/Error: directory.add_directory 'rbfs'
ArgumentError:
wrong number of arguments (1 for 2)
# /tmp/d20141111-26053-3ns4c2/solution.rb:59:in `add_directory'
# /tmp/d20141111-26053-3ns4c2/spec.rb:88:in `block (5 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
5) RBFS Directory serialization ::parse can parse empty directories
Failure/Error: parsed_directory = RBFS::Directory.parse('0:0:')
NoMethodError:
undefined method `parse' for RBFS::Directory:Class
# /tmp/d20141111-26053-3ns4c2/spec.rb:101:in `block (5 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
6) RBFS Directory serialization ::parse can parse directories with files
Failure/Error: parsed_directory = RBFS::Directory.parse(simple_serialized_string)
NoMethodError:
undefined method `parse' for RBFS::Directory:Class
# /tmp/d20141111-26053-3ns4c2/spec.rb:108:in `block (5 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
7) RBFS Directory serialization ::parse can parse directory trees without files
Failure/Error: parsed_directory = RBFS::Directory.parse('0:2:dir1:15:0:1:dir2:4:0:0:dir3:4:0:0:')
NoMethodError:
undefined method `parse' for RBFS::Directory:Class
# /tmp/d20141111-26053-3ns4c2/spec.rb:117:in `block (5 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
8) RBFS Directory serialization ::parse can parse directories recursively
Failure/Error: parsed_directory = RBFS::Directory.parse(recursive_serialized_string)
NoMethodError:
undefined method `parse' for RBFS::Directory:Class
# /tmp/d20141111-26053-3ns4c2/spec.rb:125:in `block (5 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
9) RBFS Directory #[] can walk a single directory
Failure/Error: expect(directory['home']).to eq home
expected: #<RBFS::Directory:0xb9cf790c @directory={"user"=>#<RBFS::Directory:0xb9cf786c @directory={"ruby"=>#<RBFS::Directory:0xb9cf77f4 @directory={"file"=>#<RBFS::File:0xb9cf777c @object="hi">}>}>}>
got: nil
(compared using ==)
# /tmp/d20141111-26053-3ns4c2/spec.rb:178:in `block (4 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
10) RBFS Directory #[] can walk multiple directories
Failure/Error: expect(directory['home']['user']['ruby']).to eq ruby
NoMethodError:
undefined method `[]' for nil:NilClass
# /tmp/d20141111-26053-3ns4c2/spec.rb:182:in `block (4 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
11) RBFS Directory #[] can get files
Failure/Error: expect(directory['home']['user']['ruby']['file']).to eq file
NoMethodError:
undefined method `[]' for nil:NilClass
# /tmp/d20141111-26053-3ns4c2/spec.rb:186:in `block (4 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
12) RBFS Directory #[] returns nil if directory or file doesnt exist
Failure/Error: expect(directory['home']['another_user']).to be_nil
NoMethodError:
undefined method `[]' for nil:NilClass
# /tmp/d20141111-26053-3ns4c2/spec.rb:190:in `block (4 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
13) RBFS File data type nil can be parsed
Failure/Error: expect(file.data ).to eq nil
NoMethodError:
undefined method `data' for nil:NilClass
# /tmp/d20141111-26053-3ns4c2/spec.rb:231:in `block (5 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
14) RBFS File data type string can parse a string with colons
Failure/Error: expect(file.data ).to eq 'Hay :)'
expected: "Hay :)"
got: ")"
(compared using ==)
# /tmp/d20141111-26053-3ns4c2/spec.rb:257:in `block (5 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
Finished in 0.04246 seconds
44 examples, 14 failures
Failed examples:
rspec /tmp/d20141111-26053-3ns4c2/spec.rb:149 # RBFS Directory can create empty directory
rspec /tmp/d20141111-26053-3ns4c2/spec.rb:10 # RBFS Directory without files can be serialized
rspec /tmp/d20141111-26053-3ns4c2/spec.rb:76 # RBFS Directory serialization #serialize can serialize
rspec /tmp/d20141111-26053-3ns4c2/spec.rb:84 # RBFS Directory serialization #serialize can serialize multiple directories recursively
rspec /tmp/d20141111-26053-3ns4c2/spec.rb:100 # RBFS Directory serialization ::parse can parse empty directories
rspec /tmp/d20141111-26053-3ns4c2/spec.rb:107 # RBFS Directory serialization ::parse can parse directories with files
rspec /tmp/d20141111-26053-3ns4c2/spec.rb:116 # RBFS Directory serialization ::parse can parse directory trees without files
rspec /tmp/d20141111-26053-3ns4c2/spec.rb:124 # RBFS Directory serialization ::parse can parse directories recursively
rspec /tmp/d20141111-26053-3ns4c2/spec.rb:177 # RBFS Directory #[] can walk a single directory
rspec /tmp/d20141111-26053-3ns4c2/spec.rb:181 # RBFS Directory #[] can walk multiple directories
rspec /tmp/d20141111-26053-3ns4c2/spec.rb:185 # RBFS Directory #[] can get files
rspec /tmp/d20141111-26053-3ns4c2/spec.rb:189 # RBFS Directory #[] returns nil if directory or file doesnt exist
rspec /tmp/d20141111-26053-3ns4c2/spec.rb:229 # RBFS File data type nil can be parsed
rspec /tmp/d20141111-26053-3ns4c2/spec.rb:254 # RBFS File data type string can parse a string with colons
История (1 версия и 0 коментара)
Иван обнови решението на 10.11.2014 01:49 (преди около 10 години)