Решение на Логически изрази от Петър Христов
Обратно към всички решения
Към профила на Петър Христов
Резултати
- 2 точки от тестове
- 0 бонус точки
- 2 точки общо
- 2 успешни тест(а)
- 18 неуспешни тест(а)
Код
Лог от изпълнението
Compiling solution v0.1.0 (/tmp/d20241224-258381-1kmz8zr/solution)
warning: field `arr_parsers` is never read
--> src/lib.rs:165:5
|
164 | pub struct ExprParser {
| ---------- field in this struct
165 | arr_parsers: Vec<SimpleExprParser>,
| ^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `solution` (lib) generated 1 warning
warning: variable does not need to be mutable
--> tests/solution_test.rs:306:13
|
306 | let mut parser = SimpleExprParser::new();
| ----^^^^^^
| |
| help: remove this `mut`
|
= note: `#[warn(unused_mut)]` on by default
warning: `solution` (test "solution_test") generated 1 warning
Finished test [unoptimized + debuginfo] target(s) in 1.75s
Running tests/solution_test.rs (target/debug/deps/solution_test-1428e1090729d165)
running 20 tests
test solution_test::test_error_paren_mismatched ... ok
test solution_test::test_eval_full ... FAILED
test solution_test::test_eval_not_and_or ... FAILED
test solution_test::test_eval_partial ... FAILED
test solution_test::test_eval_unwrap_and_or ... FAILED
test solution_test::test_eval_unwrap_nested ... FAILED
test solution_test::test_paren_around_expr ... FAILED
test solution_test::test_paren_expr_priority ... FAILED
test solution_test::test_paren_nested ... FAILED
test solution_test::test_paren_not ... FAILED
test solution_test::test_paren_surrounded ... FAILED
test solution_test::test_parser_and_or ... FAILED
test solution_test::test_parser_alternating_ops ... FAILED
test solution_test::test_parser_error_unexpected_end ... ok
test solution_test::test_parser_atom ... FAILED
test solution_test::test_parser_errors_basic ... FAILED
test solution_test::test_parser_expr_and_not ... FAILED
test solution_test::test_parser_multiple_atoms_same_op ... FAILED
test solution_test::test_parser_multiple_not ... FAILED
test solution_test::test_parser_not ... FAILED
failures:
---- solution_test::test_eval_full stdout ----
thread '<unnamed>' panicked at 'Expression not starting with And!', src/lib.rs:333:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'solution_test::test_eval_full' panicked at 'called `Option::unwrap()` on a `None` value', tests/solution_test.rs:371:5
---- solution_test::test_eval_not_and_or stdout ----
thread '<unnamed>' panicked at 'Expression not starting with And!', src/lib.rs:333:9
thread 'solution_test::test_eval_not_and_or' panicked at 'called `Option::unwrap()` on a `None` value', tests/solution_test.rs:387:5
---- solution_test::test_eval_partial stdout ----
thread '<unnamed>' panicked at 'Expression not starting with And!', src/lib.rs:333:9
thread 'solution_test::test_eval_partial' panicked at 'called `Option::unwrap()` on a `None` value', tests/solution_test.rs:409:5
---- solution_test::test_eval_unwrap_and_or stdout ----
thread '<unnamed>' panicked at 'Expression not starting with And!', src/lib.rs:333:9
thread 'solution_test::test_eval_unwrap_and_or' panicked at 'called `Option::unwrap()` on a `None` value', tests/solution_test.rs:456:5
---- solution_test::test_eval_unwrap_nested stdout ----
thread '<unnamed>' panicked at 'Expression not starting with And!', src/lib.rs:333:9
thread 'solution_test::test_eval_unwrap_nested' panicked at 'called `Option::unwrap()` on a `None` value', tests/solution_test.rs:479:5
---- solution_test::test_paren_around_expr stdout ----
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
left: `And([And([Atom('A')])])`,
right: `Atom('A')`', tests/solution_test.rs:179:9
thread 'solution_test::test_paren_around_expr' panicked at 'assertion failed: `(left == right)`
left: `And([And([Atom('A')])])`,
right: `Atom('A')`', tests/solution_test.rs:176:5
---- solution_test::test_paren_expr_priority stdout ----
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
left: `And([Atom('X'), Or([And([Atom('A'), Atom('B')])])])`,
right: `Or([Atom('X'), And([Atom('A'), Atom('B')])])`', tests/solution_test.rs:200:9
thread 'solution_test::test_paren_expr_priority' panicked at 'assertion failed: `(left == right)`
left: `And([Atom('X'), Or([And([Atom('A'), Atom('B')])])])`,
right: `Or([Atom('X'), And([Atom('A'), Atom('B')])])`', tests/solution_test.rs:197:5
---- solution_test::test_paren_nested stdout ----
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
left: `And([Not(And([Atom('A'), Not(And([Atom('B'), Not(And([Atom('C'), Atom('D')]))]))]))])`,
right: `Not(And([Atom('A'), Not(And([Atom('B'), Not(And([Atom('C'), Atom('D')]))]))]))`', tests/solution_test.rs:255:9
thread 'solution_test::test_paren_nested' panicked at 'assertion failed: `(left == right)`
left: `And([Not(And([Atom('A'), Not(And([Atom('B'), Not(And([Atom('C'), Atom('D')]))]))]))])`,
right: `Not(And([Atom('A'), Not(And([Atom('B'), Not(And([Atom('C'), Atom('D')]))]))]))`', tests/solution_test.rs:252:5
---- solution_test::test_paren_not stdout ----
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
left: `And([Atom('X'), Not(And([Atom('A'), Or([Atom('B')])]))])`,
right: `And([Atom('X'), Not(Or([Atom('A'), Atom('B')]))])`', tests/solution_test.rs:219:9
thread 'solution_test::test_paren_not' panicked at 'assertion failed: `(left == right)`
left: `And([Atom('X'), Not(And([Atom('A'), Or([Atom('B')])]))])`,
right: `And([Atom('X'), Not(Or([Atom('A'), Atom('B')]))])`', tests/solution_test.rs:216:5
---- solution_test::test_paren_surrounded stdout ----
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
left: `And([Atom('X'), Or([And([Atom('A'), Atom('B')]), And([Atom('C'), Atom('D')]), Atom('Y')])])`,
right: `Or([Atom('X'), And([Atom('A'), Atom('B')]), And([Atom('C'), Atom('D')]), Atom('Y')])`', tests/solution_test.rs:238:9
thread 'solution_test::test_paren_surrounded' panicked at 'assertion failed: `(left == right)`
left: `And([Atom('X'), Or([And([Atom('A'), Atom('B')]), And([Atom('C'), Atom('D')]), Atom('Y')])])`,
right: `Or([Atom('X'), And([Atom('A'), Atom('B')]), And([Atom('C'), Atom('D')]), Atom('Y')])`', tests/solution_test.rs:235:5
---- solution_test::test_parser_and_or stdout ----
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
left: `And([Atom('A'), Or([Atom('B')])])`,
right: `Or([Atom('A'), Atom('B')])`', tests/solution_test.rs:92:9
thread 'solution_test::test_parser_and_or' panicked at 'assertion failed: `(left == right)`
left: `And([Atom('A'), Or([Atom('B')])])`,
right: `Or([Atom('A'), Atom('B')])`', tests/solution_test.rs:84:5
---- solution_test::test_parser_alternating_ops stdout ----
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
left: `And([Atom('A'), Atom('B'), Or([Atom('C'), And([Atom('D')])])])`,
right: `And([Or([And([Atom('A'), Atom('B')]), Atom('C')]), Atom('D')])`', tests/solution_test.rs:160:9
thread 'solution_test::test_parser_alternating_ops' panicked at 'assertion failed: `(left == right)`
left: `And([Atom('A'), Atom('B'), Or([Atom('C'), And([Atom('D')])])])`,
right: `And([Or([And([Atom('A'), Atom('B')]), Atom('C')]), Atom('D')])`', tests/solution_test.rs:157:5
---- solution_test::test_parser_atom stdout ----
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
left: `And([Atom('A')])`,
right: `Atom('A')`', tests/solution_test.rs:78:9
thread 'solution_test::test_parser_atom' panicked at 'assertion failed: `(left == right)`
left: `And([Atom('A')])`,
right: `Atom('A')`', tests/solution_test.rs:74:5
---- solution_test::test_parser_errors_basic stdout ----
Consecutive binary operators detected
Consecutive binary operators detected
Consecutive atoms detected
thread '<unnamed>' panicked at 'assertion failed: matches!(parser.push_op(\'!\'), Err(_))', tests/solution_test.rs:278:9
thread 'solution_test::test_parser_errors_basic' panicked at 'called `Option::unwrap()` on a `None` value', tests/solution_test.rs:265:5
---- solution_test::test_parser_expr_and_not stdout ----
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
left: `And([Not(Atom('A')), Or([Atom('B')])])`,
right: `Or([Not(Atom('A')), Atom('B')])`', tests/solution_test.rs:114:9
thread 'solution_test::test_parser_expr_and_not' panicked at 'assertion failed: `(left == right)`
left: `And([Not(Atom('A')), Or([Atom('B')])])`,
right: `Or([Not(Atom('A')), Atom('B')])`', tests/solution_test.rs:107:5
---- solution_test::test_parser_multiple_atoms_same_op stdout ----
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
left: `And([Atom('X'), Or([Atom('Y'), Atom('Z'), Atom('W')])])`,
right: `Or([Atom('X'), Atom('Y'), Atom('Z'), Atom('W')])`', tests/solution_test.rs:131:9
thread 'solution_test::test_parser_multiple_atoms_same_op' panicked at 'assertion failed: `(left == right)`
left: `And([Atom('X'), Or([Atom('Y'), Atom('Z'), Atom('W')])])`,
right: `Or([Atom('X'), Atom('Y'), Atom('Z'), Atom('W')])`', tests/solution_test.rs:124:5
---- solution_test::test_parser_multiple_not stdout ----
Consecutive unary operators detected
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: UnexpectedUnaryOp', tests/solution_test.rs:142:42
thread 'solution_test::test_parser_multiple_not' panicked at 'called `Result::unwrap()` on an `Err` value: UnexpectedUnaryOp', tests/solution_test.rs:140:5
---- solution_test::test_parser_not stdout ----
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
left: `And([Not(Atom('B'))])`,
right: `Not(Atom('B'))`', tests/solution_test.rs:101:9
thread 'solution_test::test_parser_not' panicked at 'assertion failed: `(left == right)`
left: `And([Not(Atom('B'))])`,
right: `Not(Atom('B'))`', tests/solution_test.rs:98:5
failures:
solution_test::test_eval_full
solution_test::test_eval_not_and_or
solution_test::test_eval_partial
solution_test::test_eval_unwrap_and_or
solution_test::test_eval_unwrap_nested
solution_test::test_paren_around_expr
solution_test::test_paren_expr_priority
solution_test::test_paren_nested
solution_test::test_paren_not
solution_test::test_paren_surrounded
solution_test::test_parser_alternating_ops
solution_test::test_parser_and_or
solution_test::test_parser_atom
solution_test::test_parser_errors_basic
solution_test::test_parser_expr_and_not
solution_test::test_parser_multiple_atoms_same_op
solution_test::test_parser_multiple_not
solution_test::test_parser_not
test result: FAILED. 2 passed; 18 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
error: test failed, to rerun pass `--test solution_test`
История (1 версия и 1 коментар)
Петър качи първо решение на 20.12.2024 22:11 (преди 9 месеца)