-
Notifications
You must be signed in to change notification settings - Fork 5
/
test_ISOFormat.R
65 lines (56 loc) · 1.48 KB
/
test_ISOFormat.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
58
59
60
61
62
63
64
65
# test_ISOFormat.R
# Author: Emmanuel Blondel <emmanuel.blondel1@gmail.com>
#
# Description: Unit tests for ISOFormat.R
#=======================
require(geometa, quietly = TRUE)
require(testthat)
context("ISOFormat")
test_that("encoding",{
testthat::skip_on_cran()
#encoding
md <- ISOFormat$new()
md$setName("name")
md$setVersion("1.0")
md$setAmendmentNumber("2")
md$setSpecification("specification")
xml <- md$encode()
expect_is(xml, "XMLInternalNode")
#decoding
md2 <- ISOFormat$new(xml = xml)
xml2 <- md2$encode()
expect_true(ISOAbstractObject$compare(md, md2))
})
test_that("encoding -i18n",{
testthat::skip_on_cran()
#encoding
md <- ISOFormat$new()
md$setName(
"someone",
locales = list(
EN = "name in english",
FR = "nom en français",
ES = "Nombre en español",
AR = "الاسم باللغة العربية",
RU = "имя на русском",
ZH = "中文名"
))
md$setVersion("1.0")
md$setAmendmentNumber("2")
md$setSpecification(
"specification title",
locales = list(
EN="specification title",
FR="Titre de la spécification",
ES="Título de la especificación",
AR="عنوان المواصفات",
RU="название спецификации",
ZH="规范的标题"
))
xml <- md$encode()
expect_is(xml, "XMLInternalNode")
#decoding
md2 <- ISOFormat$new(xml = xml)
xml2 <- md2$encode()
expect_true(ISOAbstractObject$compare(md, md2))
})