Builds a [MapFilterProject] of a certain arity, then modifies it. The test syntax is ` [ ]` The syntax for a command is ` [ ]`
(s: &str)
| 81 | /// The test syntax is `<input_arity> [<commands>]` |
| 82 | /// The syntax for a command is `<name_of_command> [<args>]` |
| 83 | fn test_mfp(s: &str) -> Result<MapFilterProject, String> { |
| 84 | let mut input_stream = tokenize(s)?.into_iter(); |
| 85 | let mut ctx = MirScalarExprDeserializeContext::default(); |
| 86 | let input_arity = input_stream |
| 87 | .next() |
| 88 | .unwrap() |
| 89 | .to_string() |
| 90 | .parse::<usize>() |
| 91 | .map_err_to_string_with_causes()?; |
| 92 | let mut mfp = MapFilterProject::new(input_arity); |
| 93 | while let Some(command) = deserialize_optional::<MFPTestCommand, _, _>( |
| 94 | &mut input_stream, |
| 95 | "MFPTestCommand", |
| 96 | &mut ctx, |
| 97 | )? { |
| 98 | match command { |
| 99 | MFPTestCommand::Map(map) => mfp = mfp.map(map), |
| 100 | MFPTestCommand::Filter(filter) => mfp = mfp.filter(filter), |
| 101 | MFPTestCommand::Project(project) => mfp = mfp.project(project), |
| 102 | MFPTestCommand::Optimize => mfp.optimize(), |
| 103 | } |
| 104 | } |
| 105 | Ok(mfp) |
| 106 | } |
| 107 | |
| 108 | fn test_canonicalize_equiv(s: &str) -> Result<Vec<Vec<MirScalarExpr>>, String> { |
| 109 | let mut input_stream = tokenize(s)?.into_iter(); |