-
Notifications
You must be signed in to change notification settings - Fork 5
/
test_GMLGrid.R
45 lines (40 loc) · 1.05 KB
/
test_GMLGrid.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# test_GMLGrid.R
# Author: Emmanuel Blondel <emmanuel.blondel1@gmail.com>
#
# Description: Unit tests for classes inheriting GMLGrid.R
#=======================
require(geometa, quietly = TRUE)
require(sf)
require(testthat)
context("GMLGrid")
test_that("GMLGrid - with axisLabels",{
testthat::skip_on_cran()
#encoding
md <- GMLGrid$new()
envelope <- matrix(c(0,500,0,500),2,2)
md$setGridEnvelope(envelope)
md$setAxisLabels(c("E", "N"))
xml <- md$encode()
expect_is(xml, "XMLInternalNode")
#decoding
md2 <- GMLGrid$new(xml = xml)
xml2 <- md2$encode()
#assert object identity
expect_true(ISOAbstractObject$compare(md, md2))
})
test_that("GMLGrid - with axisName",{
testthat::skip_on_cran()
#encoding
md <- GMLGrid$new()
envelope <- matrix(c(0,500,0,500),2,2)
md$setGridEnvelope(envelope)
md$addAxisName("E")
md$addAxisName("N")
xml <- md$encode()
expect_is(xml, "XMLInternalNode")
#decoding
md2 <- GMLGrid$new(xml = xml)
xml2 <- md2$encode()
#assert object identity
expect_true(ISOAbstractObject$compare(md, md2))
})