File: test_Type.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 (44 lines) | stat: -rw-r--r-- 1,100 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
# test_Type.R
# Author: Emmanuel Blondel <emmanuel.blondel1@gmail.com>
#
# Description: Unit tests for SDMX Type
#=======================
require(rsdmx, quietly = TRUE)
require(testthat)
context("SDMXType")

#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)

test_that("type.SDMXType - 2.0",{
	type1 <- type.SDMXType(xmlObj1)		
	expect_equal(type1, "GenericDataType")
})

test_that("type.SDMXType - 2.1",{
  type2 <- type.SDMXType(xmlObj2)		
  expect_equal(type2, "GenericDataType")
})

test_that("SDMXType - 2.0",{
	obj1 <- SDMXType(xmlObj1)
	expect_is(obj1, "SDMXType")
})

test_that("SDMXType - 2.1",{
  obj2 <- SDMXType(xmlObj2)
  expect_is(obj2, "SDMXType")
})

test_that("getType - 2.0",{
	obj1 <- SDMXType(xmlObj1)
	expect_equal(obj1@type, "GenericDataType")
})

test_that("getType - 2.1",{
  obj2 <- SDMXType(xmlObj2)
  expect_equal(obj2@type, "GenericDataType")
})