Skip to content

Commit

Permalink
fix pull request 50
Browse files Browse the repository at this point in the history
  • Loading branch information
spinpx committed May 17, 2019
1 parent 2804edf commit 66582b3
Showing 1 changed file with 62 additions and 1 deletion.
63 changes: 62 additions & 1 deletion runtime/src/tag_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl TagSet {
}
if self.nodes[cur_lb].parent == ROOT {
if self.nodes[cur_lb].seg.begin + len as u32 == self.nodes[lb].seg.end {
self.nodes[cur_lb].seg.end = self.nodes[lb].seg.end;
self.nodes[lb].seg.begin = self.nodes[cur_lb].seg.begin;
}
}
}
Expand Down Expand Up @@ -682,6 +682,67 @@ mod tests {
);
}

#[test]
fn tag_set_tests_infer_shape() {
let mut tag_set = TagSet::new();
let mut lbs = vec![];
for i in 2..6 {
let lb = tag_set.insert(i);
lbs.push(lb);
}

let l1 = tag_set.combine_n(lbs, true);
let list = tag_set.find(l1);

assert_eq!(list.len(), 1);
assert_eq!(
list[0],
TagSeg {
sign: false,
begin: 2,
end: 6
}
);
}

#[test]
fn tag_set_tests_infer_shape2() {
// https://github.com/AngoraFuzzer/Angora/pull/50
let mut tag_set = TagSet::new();
let mut lbs = vec![];
for i in 2..6 {
let lb = tag_set.insert(i);
lbs.push(lb);
}

let l1 = tag_set.combine_n(lbs, false);

let list = tag_set.find(l1);

assert_eq!(list.len(), 4);
assert_eq!(
list[3],
TagSeg {
sign: false,
begin: 5,
end: 6
}
);

tag_set.infer_shape2(l1, 4);
let list = tag_set.find(l1);

assert_eq!(list.len(), 1);
assert_eq!(
list[0],
TagSeg {
sign: false,
begin: 2,
end: 6
}
);
}

#[test]
fn tag_set_tests_group_sign() {
let mut tag_set = TagSet::new();
Expand Down

1 comment on commit 66582b3

@EliaGeretto
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit completes the changes made in #50. (I am adding this comment so that the pull request is properly referenced, with the "#")

Please sign in to comment.