File: test_Schema.R

package info (click to toggle)
r-cran-rsdmx 0.5.7%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 940 kB
  • sloc: makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,208 bytes parent folder | download | duplicates (5)
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
# test_Schema.R
# Author: Emmanuel Blondel <emmanuel.blondel1@gmail.com>
#
# Description: Unit tests for SDMX Schema methods
#=======================
require(rsdmx, quietly = TRUE)
require(testthat)
context("SDMXSchema")

#read test data
file1 <- system.file("extdata", "SDMXMessageExample_2.0.xml", package = "rsdmx")
file2 <- system.file("extdata", "SDMXMessageExample_2.1.xml", package = "rsdmx")
xmlObj1 <- xmlParse(file1)
xmlObj2 <- xmlParse(file2)
ns1 <- namespaces.SDMX(xmlObj1)
ns2 <- namespaces.SDMX(xmlObj2)

test_that("version.SDMXSchema - 2.0",{
	schema1 = version.SDMXSchema(xmlObj1, ns1)
	expect_equal(schema1, "2.0")
})

test_that("version.SDMXSchema - 2.1",{
  schema2 = version.SDMXSchema(xmlObj2, ns2)
  expect_equal(schema2, "2.1")
})

test_that("SDMXSchema - 2.0",{
	obj1 = SDMXSchema(xmlObj1, ns1)
	expect_is(obj1, "SDMXSchema")
})

test_that("SDMXSchema - 2.1",{
  obj2 = SDMXSchema(xmlObj2, ns2)
  expect_is(obj2, "SDMXSchema")
})

test_that("getVersion - 2.0",{
	obj1 = SDMXSchema(xmlObj1, ns1)
	expect_equal(obj1@version, "2.0")
})

test_that("getVersion - 2.1",{
  obj2 = SDMXSchema(xmlObj2, ns2)
  expect_equal(obj2@version, "2.1")
})