-
Notifications
You must be signed in to change notification settings - Fork 5
/
test_GMLParameterValueGroup.R
57 lines (49 loc) · 1.54 KB
/
test_GMLParameterValueGroup.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
46
47
48
49
50
51
52
53
54
55
56
57
# test_GMLParameterValueGroup.R
# Author: Emmanuel Blondel <emmanuel.blondel1@gmail.com>
#
# Description: Unit tests for GMLParameterValueGroup.R
#=======================
require(geometa, quietly = TRUE)
require(testthat)
require(XML)
context("GMLParameterValueGroup")
test_that("encoding",{
testthat::skip_on_cran()
#encoding
pv1 <- GMLParameterValue$new()
pv1$setValue(1.0, "m")
op <- GMLOperationParameter$new()
op$setDescriptionReference("someref")
op$setIdentifier("identifier", "codespace")
op$addName("name1", "codespace")
op$addName("name2", "codespace")
op$setMinimumOccurs(2L)
pv1$setOperationParameter(op)
pv2 <- GMLParameterValue$new()
pv2$setValue(2.0, "m")
op2 <- GMLOperationParameter$new()
op2$setDescriptionReference("someref")
op2$setIdentifier("identifier", "codespace")
op2$addName("name1", "codespace")
op2$addName("name2", "codespace")
op2$setMinimumOccurs(2L)
pv2$setOperationParameter(op2)
gml <- GMLParameterValueGroup$new()
gml$addParameterValue(pv1)
gml$addParameterValue(pv2)
opg <- GMLOperationParameterGroup$new()
opg$setDescriptionReference("someref")
opg$setIdentifier("identifier", "codespace")
opg$addName("name1", "codespace")
opg$addName("name2", "codespace")
opg$setMinimumOccurs(2L)
opg$setMaximumOccurs(4L)
gml$setOperationParameterGroup(opg)
xml <- gml$encode()
expect_is(xml, "XMLInternalNode")
#decoding
gml2 <- GMLParameterValueGroup$new(xml = xml)
xml2 <- gml2$encode()
#object identity
expect_true(ISOAbstractObject$compare(gml, gml2))
})