Skip to content

Commit

Permalink
Use different equality tester of scales (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand authored Feb 8, 2024
1 parent 839cb87 commit ba372ca
Show file tree
Hide file tree
Showing 13 changed files with 141 additions and 76 deletions.
8 changes: 7 additions & 1 deletion tests/testthat/test-attackontitan.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
context("test-attackontitan")

expect_eqNe <- function(...) expect_equal(..., check.environment = FALSE)
expect_equal_scales <- function(x, y, ...) {
x <- as.list(x)
y <- as.list(y)
x$call <- y$call <- NULL
expect_equal(x, y, ...)
}

## Attack on Titan
test_that("attackOnTitan_pal raises warning with large number, x > 8", {
Expand All @@ -10,7 +16,7 @@ test_that("attackOnTitan_pal raises warning with large number, x > 8", {
})

test_that("scale_colour_attackOnTitan equals scale_color_attackOnTitan", {
expect_eqNe(scale_color_attackOnTitan(), scale_colour_attackOnTitan())
expect_equal_scales(scale_color_attackOnTitan(), scale_colour_attackOnTitan())
})

test_that("scale_colour_attackOnTitan works", {
Expand Down
13 changes: 7 additions & 6 deletions tests/testthat/test-bighero6.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
context("test-bighero6")

expect_eqNe <- function(...) expect_equal(..., check.environment=FALSE)
expect_equal_scales <- function(x, y, ...) {
x <- as.list(x)
y <- as.list(y)
x$call <- y$call <- NULL
expect_equal(x, y, ...)
}

## Big Hero 6
test_that("bigHero6_pal raises warning with large number, x > 8", {
Expand All @@ -10,12 +16,7 @@ test_that("bigHero6_pal raises warning with large number, x > 8", {
})

test_that("scale_colour_bigHero6 equals scale_color_bigHero6", {
expect_eqNe(scale_color_bigHero6(), scale_colour_bigHero6())
})

test_that("scale_color_bigHero6 name is correct", {
color_scale <- scale_color_bigHero6()
expect_equal(color_scale$scale_name, "bigHero6")
expect_equal_scales(scale_color_bigHero6(), scale_colour_bigHero6())
})

test_that("scale_colour_bigHero6 works", {
Expand Down
10 changes: 8 additions & 2 deletions tests/testthat/test-brooklyn99.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
context("test-brooklyn99")

expect_eqNe <- function(...) expect_equal(..., check.environment=FALSE)
expect_equal_scales <- function(x, y, ...) {
x <- as.list(x)
y <- as.list(y)
x$call <- y$call <- NULL
expect_equal(x, y, ...)
}

test_that("theme_brooklyn99 works", {
thm <- theme_brooklyn99()
Expand Down Expand Up @@ -64,8 +70,8 @@ test_that("brooklyn99_pal raises warning with large number, x > 10", {
})

test_that("scale_colour_brooklyn99/dark equals scale_color_brooklyn99/dark", {
expect_eqNe(scale_color_brooklyn99(palette = "Regular"), scale_colour_brooklyn99(palette = "Regular"))
expect_eqNe(scale_color_brooklyn99(palette = "Dark"), scale_colour_brooklyn99(palette = "Dark"))
expect_equal_scales(scale_color_brooklyn99(palette = "Regular"), scale_colour_brooklyn99(palette = "Regular"))
expect_equal_scales(scale_color_brooklyn99(palette = "Dark"), scale_colour_brooklyn99(palette = "Dark"))
})

test_that("scale_colour_brooklyn99/dark works", {
Expand Down
26 changes: 16 additions & 10 deletions tests/testthat/test-gameofthrones.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
context("test-gameofthrones")

expect_eqNe <- function(...) expect_equal(..., check.environment = FALSE)
expect_equal_scales <- function(x, y, ...) {
x <- as.list(x)
y <- as.list(y)
x$call <- y$call <- NULL
expect_equal(x, y, ...)
}

## House Stark ----
test_that("stark_pal raises warning with large number, x > 9", {
Expand All @@ -10,7 +16,7 @@ test_that("stark_pal raises warning with large number, x > 9", {
})

test_that("scale_colour_stark equals scale_color_stark", {
expect_eqNe(scale_color_westeros(palette = "Stark"), scale_colour_westeros(palette = "Stark"))
expect_equal_scales(scale_color_westeros(palette = "Stark"), scale_colour_westeros(palette = "Stark"))
})

test_that("scale_colour_stark works", {
Expand All @@ -27,7 +33,7 @@ test_that("Lannister_pal raises warning with large number, x > 9", {
})

test_that("scale_colour_Lannister equals scale_color_Lannister", {
expect_eqNe(scale_color_westeros(palette = "Lannister"), scale_colour_westeros(palette = "Lannister"))
expect_equal_scales(scale_color_westeros(palette = "Lannister"), scale_colour_westeros(palette = "Lannister"))
})

test_that("scale_colour_Lannister works", {
Expand All @@ -44,7 +50,7 @@ test_that("Tyrell_pal raises warning with large number, x > 9", {
})

test_that("scale_colour_Tyrell equals scale_color_Tyrell", {
expect_eqNe(scale_color_westeros(palette = "Tyrell"), scale_colour_westeros(palette = "Tyrell"))
expect_equal_scales(scale_color_westeros(palette = "Tyrell"), scale_colour_westeros(palette = "Tyrell"))
})

test_that("scale_colour_Tyrell works", {
Expand All @@ -61,7 +67,7 @@ test_that("Targaryen_pal raises warning with large number, x > 9", {
})

test_that("scale_colour_Targaryen equals scale_color_Targaryen", {
expect_eqNe(scale_color_westeros(palette = "Targaryen"), scale_colour_westeros(palette = "Targaryen"))
expect_equal_scales(scale_color_westeros(palette = "Targaryen"), scale_colour_westeros(palette = "Targaryen"))
})

test_that("scale_colour_Targaryen works", {
Expand All @@ -78,7 +84,7 @@ test_that("Tully_pal raises warning with large number, x > 9", {
})

test_that("scale_colour_Tully equals scale_color_Tully", {
expect_eqNe(scale_color_westeros(palette = "Tully"), scale_colour_westeros(palette = "Tully"))
expect_equal_scales(scale_color_westeros(palette = "Tully"), scale_colour_westeros(palette = "Tully"))
})

test_that("scale_colour_Tully works", {
Expand All @@ -95,7 +101,7 @@ test_that("Greyjoy_pal raises warning with large number, x > 9", {
})

test_that("scale_colour_Greyjoy equals scale_color_Greyjoy", {
expect_eqNe(scale_color_westeros(palette = "Greyjoy"), scale_colour_westeros(palette = "Greyjoy"))
expect_equal_scales(scale_color_westeros(palette = "Greyjoy"), scale_colour_westeros(palette = "Greyjoy"))
})

test_that("scale_colour_Greyjoy works", {
Expand All @@ -112,7 +118,7 @@ test_that("Manderly_pal raises warning with large number, x > 9", {
})

test_that("scale_colour_Manderly equals scale_color_Manderly", {
expect_eqNe(scale_color_westeros(palette = "Manderly"), scale_colour_westeros(palette = "Manderly"))
expect_equal_scales(scale_color_westeros(palette = "Manderly"), scale_colour_westeros(palette = "Manderly"))
})

test_that("scale_colour_Manderly works", {
Expand All @@ -129,7 +135,7 @@ test_that("Stannis_pal raises warning with large number, x > 9", {
})

test_that("scale_colour_Stannis equals scale_color_Stannis", {
expect_eqNe(scale_color_westeros(palette = "Stannis"), scale_colour_westeros(palette = "Stannis"))
expect_equal_scales(scale_color_westeros(palette = "Stannis"), scale_colour_westeros(palette = "Stannis"))
})

test_that("scale_colour_Stannis works", {
Expand All @@ -146,7 +152,7 @@ test_that("Martell_pal raises warning with large number, x > 9", {
})

test_that("scale_colour_Martell equals scale_color_Martell", {
expect_eqNe(scale_color_westeros(palette = "Martell"), scale_colour_westeros(palette = "Martell"))
expect_equal_scales(scale_color_westeros(palette = "Martell"), scale_colour_westeros(palette = "Martell"))
})

test_that("scale_colour_Martell works", {
Expand All @@ -163,7 +169,7 @@ test_that("Arryn_pal raises warning with large number, x > 9", {
})

test_that("scale_colour_Arryn equals scale_color_Arryn", {
expect_eqNe(scale_color_westeros(palette = "Arryn"), scale_colour_westeros(palette = "Arryn"))
expect_equal_scales(scale_color_westeros(palette = "Arryn"), scale_colour_westeros(palette = "Arryn"))
})

test_that("scale_colour_Arryn works", {
Expand Down
13 changes: 7 additions & 6 deletions tests/testthat/test-gravityfalls.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
context("test-gravityFalls")

expect_eqNe <- function(...) expect_equal(..., check.environment = FALSE)
expect_equal_scales <- function(x, y, ...) {
x <- as.list(x)
y <- as.list(y)
x$call <- y$call <- NULL
expect_equal(x, y, ...)
}

## Big Hero 6
test_that("gravityFalls_pal raises warning with large number, x > 15", {
Expand All @@ -10,12 +16,7 @@ test_that("gravityFalls_pal raises warning with large number, x > 15", {
})

test_that("scale_colour_gravityFalls equals scale_color_gravityFalls", {
expect_eqNe(scale_color_gravityFalls(), scale_colour_gravityFalls())
})

test_that("scale_color_gravityFalls name is correct", {
color_scale <- scale_color_gravityFalls()
expect_equal(color_scale$scale_name, "gravityFalls")
expect_equal_scales(scale_color_gravityFalls(), scale_colour_gravityFalls())
})

test_that("scale_colour_gravityFalls works", {
Expand Down
12 changes: 9 additions & 3 deletions tests/testthat/test-hilda.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
context("test-hilda")

expect_eqNe <- function(...) expect_equal(..., check.environment = FALSE)
expect_equal_scales <- function(x, y, ...) {
x <- as.list(x)
y <- as.list(y)
x$call <- y$call <- NULL
expect_equal(x, y, ...)
}

# Hilda Day ----
test_that("theme_hildaDay works", {
Expand Down Expand Up @@ -66,7 +72,7 @@ test_that("hilda_pal raises warning with large number, x > 8", {
})

test_that("scale_colour_hilda equals scale_color_hilda", {
expect_eqNe(scale_color_hilda(palette = "Day"), scale_colour_hilda(palette = "Day"))
expect_equal_scales(scale_color_hilda(palette = "Day"), scale_colour_hilda(palette = "Day"))
})

test_that("scale_colour_hilda works", {
Expand Down Expand Up @@ -139,7 +145,7 @@ test_that("hilda_pal raises warning with large number, x > 8", {
})

test_that("scale_colour_hilda equals scale_color_hilda", {
expect_eqNe(scale_color_hilda(palette = "Dusk"), scale_colour_hilda(palette = "Dusk"))
expect_equal_scales(scale_color_hilda(palette = "Dusk"), scale_colour_hilda(palette = "Dusk"))
})

test_that("scale_colour_hilda works", {
Expand Down Expand Up @@ -212,7 +218,7 @@ test_that("hilda_pal raises warning with large number, x > 8", {
})

test_that("scale_colour_hilda equals scale_color_hilda", {
expect_eqNe(scale_color_hilda(palette = "Night"), scale_colour_hilda(palette = "Night"))
expect_equal_scales(scale_color_hilda(palette = "Night"), scale_colour_hilda(palette = "Night"))
})

test_that("scale_colour_hilda works", {
Expand Down
13 changes: 7 additions & 6 deletions tests/testthat/test-kimpossible.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
context("test-kimpossible")

expect_eqNe <- function(...) expect_equal(..., check.environment = FALSE)
expect_equal_scales <- function(x, y, ...) {
x <- as.list(x)
y <- as.list(y)
x$call <- y$call <- NULL
expect_equal(x, y, ...)
}

## Kim Possible
test_that("kimPossible_pal raises warning with large number, x > 12", {
Expand All @@ -10,12 +16,7 @@ test_that("kimPossible_pal raises warning with large number, x > 12", {
})

test_that("scale_colour_kimPossible equals scale_color_kimPossible", {
expect_eqNe(scale_color_kimPossible(), scale_colour_kimPossible())
})

test_that("scale_color_kimPossible name is correct", {
color_scale <- scale_color_kimPossible()
expect_equal(color_scale$scale_name, "kimPossible")
expect_equal_scales(scale_color_kimPossible(), scale_colour_kimPossible())
})

test_that("scale_colour_kimPossible works", {
Expand Down
9 changes: 8 additions & 1 deletion tests/testthat/test-parksandrec.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
context("test-parksandrec")

expect_eqNe <- function(...) expect_equal(..., check.environment = FALSE)
expect_equal_scales <- function(x, y, ...) {
x <- as.list(x)
y <- as.list(y)
x$call <- y$call <- NULL
expect_equal(x, y, ...)
}


test_that("theme_parksAndRec works", {
thm <- theme_parksAndRec()
Expand Down Expand Up @@ -176,7 +183,7 @@ test_that("parksAndRec_pal raises warning with large number, x > 10", {
})

test_that("scale_colour_parksAndRec equals scale_color_parksAndRec", {
expect_eqNe(scale_color_parksAndRec(), scale_colour_parksAndRec())
expect_equal_scales(scale_color_parksAndRec(), scale_colour_parksAndRec())
})

test_that("scale_colour_parksAndRec/light works", {
Expand Down
8 changes: 7 additions & 1 deletion tests/testthat/test-rickandmorty.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
context("test-rickandmorty")

expect_eqNe <- function(...) expect_equal(..., check.environment = FALSE)
expect_equal_scales <- function(x, y, ...) {
x <- as.list(x)
y <- as.list(y)
x$call <- y$call <- NULL
expect_equal(x, y, ...)
}

test_that("theme_rickAndMorty works", {
thm <- theme_rickAndMorty()
Expand Down Expand Up @@ -64,7 +70,7 @@ test_that("rickAndMorty_pal raises warning with large number, x > 9", {
})

test_that("scale_colour_rickAndMorty equals scale_color_rickAndMorty", {
expect_eqNe(scale_color_rickAndMorty(), scale_colour_rickAndMorty())
expect_equal_scales(scale_color_rickAndMorty(), scale_colour_rickAndMorty())
})

test_that("scale_colour_rickAndMorty works", {
Expand Down
8 changes: 7 additions & 1 deletion tests/testthat/test-simpsons.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
context("test-simpsons")

expect_eqNe <- function(...) expect_equal(..., check.environment = FALSE)
expect_equal_scales <- function(x, y, ...) {
x <- as.list(x)
y <- as.list(y)
x$call <- y$call <- NULL
expect_equal(x, y, ...)
}

test_that("theme_simpsons works", {
thm <- theme_simpsons()
Expand Down Expand Up @@ -64,7 +70,7 @@ test_that("simpsons_pal raises warning with large number, x > 10", {
})

test_that("scale_colour_simpsons equals scale_color_simpsons", {
expect_eqNe(scale_color_simpsons(), scale_colour_simpsons())
expect_equal_scales(scale_color_simpsons(), scale_colour_simpsons())
})

test_that("scale_colour_simpsons works", {
Expand Down
8 changes: 7 additions & 1 deletion tests/testthat/test-spongebob.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
context("test-spongebob")

expect_eqNe <- function(...) expect_equal(..., check.environment = FALSE)
expect_equal_scales <- function(x, y, ...) {
x <- as.list(x)
y <- as.list(y)
x$call <- y$call <- NULL
expect_equal(x, y, ...)
}

test_that("theme_spongeBob works", {
thm <- theme_spongeBob()
Expand Down Expand Up @@ -64,7 +70,7 @@ test_that("spongeBob_pal raises warning with large number, x > 9", {
})

test_that("scale_colour_spongeBob equals scale_color_spongeBob", {
expect_eqNe(scale_color_spongeBob(), scale_colour_spongeBob())
expect_equal_scales(scale_color_spongeBob(), scale_colour_spongeBob())
})

test_that("scale_colour_spongeBob works", {
Expand Down
Loading

0 comments on commit ba372ca

Please sign in to comment.