MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / test_parse_code_coverage

Function test_parse_code_coverage

src/feedback/clang_coverage.rs:740–768  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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<()> {

Callers

nothing calls this directly

Calls 2

get_function_covMethod · 0.80

Tested by

no test coverage detected