as.character(unique(res$area)) not identical to intersect(data1$area, data2$area).
Types not compatible: character is not integer

data1 <- readAntares(c("a", "b"), select = c("LOAD", "BALANCE"),
timeStep = "annual", showProgress = FALSE)
it("returns an object with same structure than the input", {
data2 <- readAntares(c("a", "b"), select = c("LOAD", "BALANCE"),
it("keeps only shared rows and columns", {
data2 <- readAntares(c("b", "c"), select = c("LOAD", "BALANCE", "MRG. PRICE"),
it("stops if x and y have different types", {
data2 <- readAntares(links = "all", select = c("FLOW LIN."),
expect_true(all(res$LOAD == 0 & res$BALANCE == 0))
mydata <- readAntares(c("a", "b"), select = c("LOAD"),
mydata2 <- mydata2[, LOAD := LOAD * 1.2]
test_that("Differences are correctly computed", {
res <- antaresProcessing::compare(mydata, mydata2, "diff")
test_that("Ratios are correctly computed", {
res <- antaresProcessing::compare(mydata, mydata2, "ratio")
expect_true(all(res$LOAD - 1.2 < 1e-10))
test_that("Evolutions are correctly computed", {
res <- antaresProcessing::compare(mydata, mydata2, "rate")
expect_true(all(res$LOAD - 0.2 < 1e-10))
test_that("if x = y, then the res is idential to x",
data1 <- readAntares(areas = c("a", "b"), select = c("LOAD", "BALANCE"),
timeStep = "hourly", showProgress = FALSE)
data2 <- readAntares(areas = c("a", "b"), select = c("LOAD", "BALANCE"),
if (class(attr(data1, t)) != "externalptr" & t != "type" & t != "opts"){
expect_true(all(attr(data1, t) == attr(res, t)),
paste0("attr(data1, t) : ", attr(data1, t), " != ", "attr(res, t) : ", attr(res, t) ))
test_that("x and y can be antaresDataList ", {
links = getLinks(exclude = getAreas("off")),
expect_false("a - a_offshore" %in% unique(res$links$link))
expect_true("a and b" %in% unique(res$districts$district))
test_that("x and y can be antaresDataList but they must have the same names ", {
test_that("x and y can be antaresDataList, diff must work ", {
data2$links[link == "b - c", `FLOW LIN.` := `FLOW LIN.` + as.integer(10000)]
data2$clusters <- data2$clusters[area == "c" & cluster == "base", production := as.integer(production * 1.8)]
data2$districts <- data2$districts[, `MRG. PRICE` :=  `MRG. PRICE` + 1.20]
expect_equal(res$links[link == "b - c", `FLOW LIN.`], rep(10000, 336))
expect_equal(res$clusters[area == "c" & cluster == "base", production ],  data1$clusters[area == "c" & cluster == "base", production ]*0.8)
expect_equal(res$districts[, `MRG. PRICE` ], rep(1.20, 336))
test_that("compare return a warning when diff is empty, no row", {