MCPcopy Create free account
hub / github.com/csmith-project/csmith / parse_single_elem

Method parse_single_elem

src/Probabilities.cpp:1008–1023  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1006}
1007
1008int
1009Probabilities::parse_single_elem(bool is_equal, ProbElem *elem, const std::string &line)
1010{
1011 assert(elem);
1012 std::vector<std::string> pairs;
1013 StringUtils::split_string(line, pairs, SingleProbElem::single_elem_sep_char);
1014 assert(pairs.size() == 2);
1015 int val = StringUtils::str2int(pairs[1]);
1016 if (is_equal)
1017 assert(val == 0 || val == 1);
1018 else
1019 assert(val >= 0 && val <= 100);
1020 ProbName pname = get_pname(pairs[0]);
1021 elem->set_prob(pname, val);
1022 return val;
1023}
1024
1025bool
1026Probabilities::parse_single_probability(std::string &, const std::string &line)

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.80
set_probMethod · 0.45

Tested by

no test coverage detected