Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guideline Detection Problems in Nested Lists #94

Closed
brodieG opened this issue Nov 17, 2016 · 1 comment
Closed

Guideline Detection Problems in Nested Lists #94

brodieG opened this issue Nov 17, 2016 · 1 comment
Labels
Milestone

Comments

@brodieG
Copy link
Owner

brodieG commented Nov 17, 2016

with:

rand_nested_list <- function(
  depth=1, max.depth=5, max.length=5, vec.size=32
) {
  res <- vector("list", sample(max.length, 1))
  for(i in seq_along(res)) {
    res[[i]] <- if(depth >= max.depth || runif(1) < .2) {
      sample(1:1000, vec.size)
    } else {
      Recall(depth + 1L, max.depth, max.length)
    }
  }
  res
}
mangle <- function(z)
  if(runif(1) < .4) {
    if(rand <- runif(1) < .5) z[-sample(length(z), sample(3, 1))]
    else {
      for(j in rev(sort(sample(length(z), min(3, length(z))))))
        z <- append(z, sample(1:1000, 1), after=j)
      z
    }
  } else z

These should not have guidelines shown:

set.seed(4)
x <- rand_nested_list(max.depth=3, max.length=3)
y <- rapply(x, how="list", mangle)
diffPrint(x, y, context=1)

screen shot 2016-11-17 at 11 20 38 am

A better example, why do we get guideline treatment on second to last, but not on last hunk:

set.seed(10)
x <- rand_nested_list(max.depth=3, max.length=3, vec.size=25)
y <- rapply(x, how="list", mangle)
diffPrint(x, y)

screen shot 2016-11-17 at 11 37 30 am

@brodieG brodieG added the bug label Nov 17, 2016
@brodieG brodieG added this to the 0.1.7 milestone Nov 17, 2016
@brodieG
Copy link
Owner Author

brodieG commented Nov 9, 2017

This is actually correct. For the first example, with context =1 the index line would not normally be shown, so it should show up at a guideline, even if it is adjacent to the normally displayed hunk.

@brodieG brodieG closed this as completed Nov 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant