tests/testthat/test-bins.R

context("test-bins.R")



test_that("bins works", {

  rando <- c(6308931, 8842288, 13611957, 21580540, 4792301, 21347245, 22447068, 15701664, 14948805, 1468146)
expect_equal(as.integer(unlist(lapply(bin2lonlat(rando, 4320), round, digits = 7)) * 1e7), 
              c(943879423, -487010655, -1523903124, -141431149, 1423225620, 958598238, -1796808511, -986479218, -1230409777, 1283549784, -279791667, -148125000, 83958333, 547291667, -366458333, 528125000, 628125000, 187708333, 149791667, -612291667))
  
rando <- c(17893027, 15337499, 59681726, 33367119, 66876182, 43235170, 62339573, 86166956, 33013685, 67536724)
  expect_equal(as.integer(unlist(lapply(bin2lonlat(rando, 8260), round, digits = 7)) * 1e7), 
               c(-1306862232, -558330026, 1674650829, 1685182650, 1170407650, 1445338983, 1622226704, -809057114, 1629282285, 362907451, -360108959, -403038741, 219552058, -134128329, 326549637, -2723971, 257905569, 796815981, -138922518, 337009685))
  rando <- c(8897, 4289, 13173, 2538, 5402, 7804, 271, 7728, 17575, 6878, 9741, 12115, 9972, 3763, 16715, 13504, 16044, 2181, 14618, 8307)
  
  expect_equal(as.integer(unlist(lapply(bin2lonlat(rando, 8260), round, digits = 7)) * 1e7), 
  c(-1033928571, 1603493450, 906666666, -321787709, -137931034, 1215434084, -810000000, 335691318, 1057692308, 1029452055, 649856734, -1447328244, -588169014, 364976958, 1590329670, 214077670, -144320713, -582035928, -1042325581, -294444444, -888341404, -892046005, -885944310, -893789345, -890956415, -889213075, -897929781, -889213075, -883765133, -889866828, -887905569, -886380145, -887687651, -892481840, -884200969, -885726392, -884418886, -894225182, -885072639, -888777240))
  
  

})
mdsumner/roc documentation built on May 22, 2019, 5:05 p.m.