()
| 738 | |
| 739 | #[test] |
| 740 | fn test_parse_code_coverage() -> Result<()> { |
| 741 | crate::config::Config::init_test("cJSON"); |
| 742 | let deopt = Deopt::new("cJSON".to_string())?; |
| 743 | let profdata: PathBuf = [ |
| 744 | crate::Deopt::get_crate_dir()?, |
| 745 | "testsuites", |
| 746 | "corpora", |
| 747 | "default.profdata", |
| 748 | ] |
| 749 | .iter() |
| 750 | .collect(); |
| 751 | let executor = Executor::new(&deopt)?; |
| 752 | let cov = executor.obtain_cov_from_profdata(&profdata)?; |
| 753 | let gsv = cov.get_function_cov("cJSON_GetStringValue").unwrap(); |
| 754 | assert_eq!( |
| 755 | gsv.lines, |
| 756 | vec![ |
| 757 | [100, 110], |
| 758 | [101, 110], |
| 759 | [102, 90], |
| 760 | [103, 90], |
| 761 | [104, 90], |
| 762 | [106, 20], |
| 763 | [107, 110] |
| 764 | ] |
| 765 | ); |
| 766 | assert_eq!(gsv.compute_line_coverage(), 1_f32); |
| 767 | Ok(()) |
| 768 | } |
| 769 | |
| 770 | #[test] |
| 771 | fn test_ccollect_lib_cov_per_fuzzer() -> Result<()> { |
nothing calls this directly
no test coverage detected