()
| 4957 | |
| 4958 | #[test] |
| 4959 | fn test_malformed_graphs() { |
| 4960 | let context = create_unchecked_context().unwrap(); |
| 4961 | let graph = context.create_graph().unwrap(); |
| 4962 | let graph2 = context.create_graph().unwrap(); |
| 4963 | let input1 = graph.input(scalar_type(UINT64)).unwrap(); |
| 4964 | let input2 = graph2.input(scalar_type(UINT64)).unwrap(); |
| 4965 | let e1 = graph.add(input1.clone(), input2.clone()); |
| 4966 | assert!(e1.is_err()); |
| 4967 | let fake_node = Node { |
| 4968 | body: Arc::new(AtomicRefCell::new(NodeBody { |
| 4969 | graph: graph.downgrade(), |
| 4970 | node_dependencies: vec![], |
| 4971 | graph_dependencies: vec![], |
| 4972 | operation: Operation::Input(scalar_type(BIT)), |
| 4973 | id: 0, |
| 4974 | })), |
| 4975 | }; |
| 4976 | let e2 = graph.add(fake_node.clone(), input1.clone()); |
| 4977 | assert!(e2.is_err()); |
| 4978 | let fake_node_2 = Node { |
| 4979 | body: Arc::new(AtomicRefCell::new(NodeBody { |
| 4980 | graph: graph.downgrade(), |
| 4981 | node_dependencies: vec![], |
| 4982 | graph_dependencies: vec![], |
| 4983 | operation: Operation::Input(scalar_type(BIT)), |
| 4984 | id: 31337, |
| 4985 | })), |
| 4986 | }; |
| 4987 | let e3 = graph.add(fake_node_2.clone(), input1.clone()); |
| 4988 | assert!(e3.is_err()); |
| 4989 | graph.set_output_node(input1.clone()).unwrap(); |
| 4990 | graph.finalize().unwrap(); |
| 4991 | let e4 = graph.add(input1.clone(), input1.clone()); |
| 4992 | assert!(e4.is_err()); |
| 4993 | let graph3 = context.create_graph().unwrap(); |
| 4994 | let e5 = graph3.finalize(); |
| 4995 | assert!(e5.is_err()); |
| 4996 | let e6 = graph3.set_output_node(input1); |
| 4997 | assert!(e6.is_err()); |
| 4998 | } |
| 4999 | |
| 5000 | #[test] |
| 5001 | fn test_malformed_contexts() { |
nothing calls this directly
no test coverage detected