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

Function select_max_array_constraint

src/program/infer/static_infer.rs:397–416  ·  view source on GitHub ↗
(constraints: Vec<Constraint>)

Source from the content-addressed store, hash-verified

395}
396
397fn select_max_array_constraint(constraints: Vec<Constraint>) -> Vec<Constraint> {
398 let mut counter: HashMap<usize, usize> = HashMap::new();
399 for constraint in &constraints {
400 let integer_arg = constraint.get_integer_arg();
401 *counter.entry(integer_arg).or_default() += 1;
402 }
403 let max_arg = counter
404 .iter()
405 .max_by_key(|x| x.1)
406 .expect("should not be empty");
407 let max_integer_arg = *max_arg.0;
408 let mut retained = Vec::new();
409 for constraint in constraints {
410 let integer_arg = constraint.get_integer_arg();
411 if integer_arg == max_integer_arg {
412 retained.push(constraint);
413 }
414 }
415 retained
416}
417
418/// LLM is possible to assign a string argument with "input_file" name, so check whether this constraint is well inferred
419fn refine_file_name_constraint(func: &str, constraints: Vec<Constraint>) -> Vec<Constraint> {

Callers 1

Calls 2

get_integer_argMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected