(&self)
| 19 | |
| 20 | impl Serialize for Program { |
| 21 | fn serialize(&self) -> String { |
| 22 | let combination: Vec<String> = self |
| 23 | .combination |
| 24 | .iter() |
| 25 | .map(|x| x.get_func_name().to_string()) |
| 26 | .collect(); |
| 27 | let mut out = format!("//<ID> {}\n", self.id); |
| 28 | out.push_str(&format!( |
| 29 | "//<Prompt> {}\n", |
| 30 | serde_json::to_string(&combination).unwrap() |
| 31 | )); |
| 32 | out.push_str("/*<Combination>: ["); |
| 33 | out.push_str(&combination_to_str(&self.combination)); |
| 34 | out.push_str("\n*/\n"); |
| 35 | out.push_str(&format!( |
| 36 | "//<score> {}, nr_unique_branch: {}\n", |
| 37 | self.get_quality().compute_quality_score(), |
| 38 | self.get_quality().get_nr_unique_branches(), |
| 39 | )); |
| 40 | out.push_str(&format!( |
| 41 | "//<Quality> {}\n", |
| 42 | serde_json::to_string(&self.quality).unwrap() |
| 43 | )); |
| 44 | out.push_str(&self.statements); |
| 45 | out |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | impl Deserialize for Program { |
no test coverage detected