From a71b78afc8305821e7c960bc70a24f7ec8db0b9a Mon Sep 17 00:00:00 2001
From: eblondel <emmanuel.blondel1@gmail.com>
Date: Thu, 12 May 2022 22:14:29 +0200
Subject: [PATCH] #187 SWE Category, Quantity, CountRange

---
 NAMESPACE                                     |  3 +
 R/SWECategory.R                               | 74 +++++++++++++++++++
 R/SWECountRange.R                             | 73 ++++++++++++++++++
 R/SWEQuantity.R                               | 73 ++++++++++++++++++
 R/SWEQuantityRange.R                          |  4 +-
 README.md                                     |  2 +-
 .../coverage/geometa_coverage_inventory.csv   |  6 +-
 .../coverage/geometa_coverage_summary.csv     |  2 +-
 .../coverage/geometa_coverage_summary.md      |  2 +-
 man/SWECategory.Rd                            | 54 ++++++++++++++
 man/SWECountRange.Rd                          | 48 ++++++++++++
 man/SWEQuantity.Rd                            | 54 ++++++++++++++
 tests/testthat/test_SWECategory.R             | 23 ++++++
 tests/testthat/test_SWEQuantity.R             | 23 ++++++
 tests/testthat/test_SWeCountRange.R           | 23 ++++++
 15 files changed, 457 insertions(+), 7 deletions(-)
 create mode 100644 R/SWECategory.R
 create mode 100644 R/SWECountRange.R
 create mode 100644 R/SWEQuantity.R
 create mode 100644 man/SWECategory.Rd
 create mode 100644 man/SWECountRange.Rd
 create mode 100644 man/SWEQuantity.Rd
 create mode 100644 tests/testthat/test_SWECategory.R
 create mode 100644 tests/testthat/test_SWEQuantity.R
 create mode 100644 tests/testthat/test_SWeCountRange.R

diff --git a/NAMESPACE b/NAMESPACE
index 96d66991..c9000fca 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -322,8 +322,11 @@ export(ISOVerticalExtent)
 export(SWEAbstractDataComponent)
 export(SWEAbstractObject)
 export(SWEAbstractSimpleComponent)
+export(SWECategory)
 export(SWECategoryRange)
 export(SWECount)
+export(SWECountRange)
+export(SWEQuantity)
 export(SWEQuantityRange)
 export(SWEText)
 export(cacheISOClasses)
diff --git a/R/SWECategory.R b/R/SWECategory.R
new file mode 100644
index 00000000..9ace559b
--- /dev/null
+++ b/R/SWECategory.R
@@ -0,0 +1,74 @@
+#' SWECategory
+#'
+#' @docType class
+#' @importFrom R6 R6Class
+#' @export
+#' @keywords ISO SWE
+#' @return Object of \code{\link{R6Class}} for modelling an SWE Category
+#' @format \code{\link{R6Class}} object.
+#' 
+#' @references 
+#'   OGC Geography Markup Language. https://www.ogc.org/standards/swecommon
+#' 
+#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
+#'
+SWECategory <- R6Class("SWECategory",
+   inherit = SWEAbstractSimpleComponent,
+   private = list(
+     xmlElement = "Category",
+     xmlNamespacePrefix = "SWE"
+   ),
+   public = list(
+     
+     #'@field codeSpace codeSpace
+     codeSpace = NULL,
+     
+     #'@field constraint constraint
+     constraint = NULL,
+     
+     #'@field value value
+     value = NA_character_,
+     
+     #'@description Initializes an object of class \link{SWECategory}
+     #'@param xml object of class \link{XMLInternalNode-class} from \pkg{XML}
+     #'@param codeSpace codeSpace
+     #'@param constraint constraint
+     #'@param value value
+     #'@param updatable updatable
+     #'@param optional optional
+     #'@param definition definition
+     initialize = function(xml = NULL, 
+                           codeSpace = NULL, constraint = NULL, value = NULL,
+                           updatable = NULL, optional = FALSE, definition = NULL){
+       super$initialize(xml, element = private$xmlElement,
+                        updatable = updatable, optional = optional, definition = definition)
+       if(is.null(xml)){
+         self$setCodeSpace(codeSpace)
+         self$setConstraint(constraint)
+         self$setValue(value)
+       }
+     },
+     
+     
+     #'@description setCodeSpace
+     #'@param codeSpace codeSpace
+     setCodeSpace = function(codeSpace){
+       self$codeSpace <- codeSpace
+     },
+     
+     #'@description setConstraint
+     #'@param constraint constraint
+     setConstraint = function(constraint){
+       self$constraint <- constraint
+     },
+     
+     #'@description setValue
+     #'@param value value
+     setValue = function(value){
+       if(!is.character(value)){
+         stop("Values should be character")
+       }
+       self$value <- value
+     }
+   )                        
+)
\ No newline at end of file
diff --git a/R/SWECountRange.R b/R/SWECountRange.R
new file mode 100644
index 00000000..bc3a9e2c
--- /dev/null
+++ b/R/SWECountRange.R
@@ -0,0 +1,73 @@
+#' SWECountRange
+#'
+#' @docType class
+#' @importFrom R6 R6Class
+#' @export
+#' @keywords ISO SWE
+#' @return Object of \code{\link{R6Class}} for modelling an SWE CountRange
+#' @format \code{\link{R6Class}} object.
+#' 
+#' @references 
+#'   OGC Geography Markup Language. https://www.ogc.org/standards/swecommon
+#' 
+#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
+#'
+SWECountRange <- R6Class("SWECountRange",
+  inherit = SWEAbstractSimpleComponent,
+  private = list(
+    xmlElement = "CountRange",
+    xmlNamespacePrefix = "SWE"
+  ),
+  public = list(
+    
+    #'@field constraint constraint
+    constraint = NULL,
+    
+    #'@field value  value
+    value = matrix(NA_integer_, 1, 2),
+    
+    #'@description Initializes an object of class \link{SWECountRange}
+    #'@param xml object of class \link{XMLInternalNode-class} from \pkg{XML}
+    #'@param constraint constraint
+    #'@param value value
+    #'@param updatable updatable
+    #'@param optional optional
+    #'@param definition definition
+    initialize = function(xml = NULL, 
+                          constraint = NULL, value = NULL,
+                          updatable = NULL, optional = FALSE, definition = NULL){
+      super$initialize(xml, element = private$xmlElement,
+                       updatable = updatable, optional = optional, definition = definition)
+      if(is.null(xml)){
+        self$setConstraint(constraint)
+        self$setValue(value)
+      }
+    },
+    
+    #'@description setConstraint
+    #'@param constraint constraint
+    setConstraint = function(constraint){
+      self$constraint <- constraint
+    },
+    
+    #'@description setValue
+    #'@param value value
+    setValue = function(value){
+      if(!is.integer(value)){
+        stop("Values should be integer")
+      }
+      if(is.vector(value)){
+        if(length(value)!="2"){
+          stop("Vector of values should of length 2")
+        }
+      }else if(is.matrix(value)){
+        if(!all(dim(value)==c(1,2))){
+          stop("Matrix of values should be of dimensions 1,2")
+        }
+      }else{
+        stop("Value should be either a vector or matrix")
+      }
+      self$value <- value
+    }
+  )                        
+)
\ No newline at end of file
diff --git a/R/SWEQuantity.R b/R/SWEQuantity.R
new file mode 100644
index 00000000..145d3de4
--- /dev/null
+++ b/R/SWEQuantity.R
@@ -0,0 +1,73 @@
+#' SWEQuantity
+#'
+#' @docType class
+#' @importFrom R6 R6Class
+#' @export
+#' @keywords ISO SWE
+#' @return Object of \code{\link{R6Class}} for modelling an SWE Quantity
+#' @format \code{\link{R6Class}} object.
+#' 
+#' @references 
+#'   OGC Geography Markup Language. https://www.ogc.org/standards/swecommon
+#' 
+#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
+#'
+SWEQuantity <- R6Class("SWEQuantity",
+  inherit = SWEAbstractSimpleComponent,
+  private = list(
+    xmlElement = "Quantity",
+    xmlNamespacePrefix = "SWE"
+  ),
+  public = list(
+    
+    #'@field uom uom
+    uom = NULL,
+    
+    #'@field constraint constraint
+    constraint = NULL,
+    
+    #'@field value value
+    value = NA_real_,
+    
+    #'@description Initializes an object of class \link{SWEQuantity}
+    #'@param xml object of class \link{XMLInternalNode-class} from \pkg{XML}
+    #'@param uom uom
+    #'@param constraint constraint
+    #'@param value value
+    #'@param updatable updatable
+    #'@param optional optional
+    #'@param definition definition
+    initialize = function(xml = NULL, 
+                          uom = NULL, constraint = NULL, value = NULL,
+                          updatable = NULL, optional = FALSE, definition = NULL){
+      super$initialize(xml, element = private$xmlElement,
+                       updatable = updatable, optional = optional, definition = definition)
+      if(is.null(xml)){
+        self$setUom(uom)
+        self$setConstraint(constraint)
+        self$setValue(value)
+      }
+    },
+    
+    #'@description setUom
+    #'@param uom uom
+    setUom = function(uom){
+      self$uom <- uom
+    },
+    
+    #'@description setConstraint
+    #'@param constraint constraint
+    setConstraint = function(constraint){
+      self$constraint <- constraint
+    },
+    
+    #'@description setValue
+    #'@param value value
+    setValue = function(value){
+      if(!is.numeric(value)){
+        stop("Values should be numeric")
+      }
+      self$value <- value
+    }
+  )                        
+)
\ No newline at end of file
diff --git a/R/SWEQuantityRange.R b/R/SWEQuantityRange.R
index 246adfe7..4c2f02df 100644
--- a/R/SWEQuantityRange.R
+++ b/R/SWEQuantityRange.R
@@ -31,17 +31,19 @@ SWEQuantityRange <- R6Class("SWEQuantityRange",
      
      #'@description Initializes an object of class \link{SWEQuantityRange}
      #'@param xml object of class \link{XMLInternalNode-class} from \pkg{XML}
+     #'@param uom uom
      #'@param constraint constraint
      #'@param value value
      #'@param updatable updatable
      #'@param optional optional
      #'@param definition definition
      initialize = function(xml = NULL, 
-                           constraint = NULL, value = NULL,
+                           uom = NULL, constraint = NULL, value = NULL,
                            updatable = NULL, optional = FALSE, definition = NULL){
        super$initialize(xml, element = private$xmlElement,
                         updatable = updatable, optional = optional, definition = definition)
        if(is.null(xml)){
+         self$setUom(uom)
          self$setConstraint(constraint)
          self$setValue(value)
        }
diff --git a/README.md b/README.md
index 9e6f119e..a08eb75e 100644
--- a/README.md
+++ b/README.md
@@ -37,4 +37,4 @@ We thank in advance people that use ``geometa`` for citing it in their work / pu
 |GML 3.2.1 (ISO 19136)                |Geographic Markup Language                                                          |GML       |[![GML 3.2.1 (ISO 19136)](https://img.shields.io/badge/-37%25-ff0c0c.svg)](https://github.com/eblondel/geometa)                 |        63|     106|
 |GML 3.2.1 Coverage (OGC GMLCOV)      |OGC GML Coverage Implementation Schema                                              |GMLCOV    |[![GML 3.2.1 Coverage (OGC GMLCOV)](https://img.shields.io/badge/-100%25-4a4ea8.svg)](https://github.com/eblondel/geometa)      |         1|       0|
 |GML 3.3 Referenceable Grid (OGC GML) |OGC GML Referenceable Grid                                                          |GMLRGRID  |[![GML 3.3 Referenceable Grid (OGC GML)](https://img.shields.io/badge/-100%25-4a4ea8.svg)](https://github.com/eblondel/geometa) |         5|       0|
-|SWE 2.0                              |Sensor Web Enablement (SWE) Common Data Model                                       |SWE       |[![SWE 2.0](https://img.shields.io/badge/-23%25-ff0c0c.svg)](https://github.com/eblondel/geometa)                               |         7|      23|
+|SWE 2.0                              |Sensor Web Enablement (SWE) Common Data Model                                       |SWE       |[![SWE 2.0](https://img.shields.io/badge/-33%25-ff0c0c.svg)](https://github.com/eblondel/geometa)                               |        10|      20|
diff --git a/inst/extdata/coverage/geometa_coverage_inventory.csv b/inst/extdata/coverage/geometa_coverage_inventory.csv
index e6fa06ff..847b1980 100644
--- a/inst/extdata/coverage/geometa_coverage_inventory.csv
+++ b/inst/extdata/coverage/geometa_coverage_inventory.csv
@@ -483,18 +483,18 @@
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","AllowedValues","<missing>",FALSE
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","BinaryEncoding","<missing>",FALSE
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Block","<missing>",FALSE
-"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Category","<missing>",FALSE
+"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Category","SWECategory",TRUE
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","CategoryRange","SWECategoryRange",TRUE
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Component","<missing>",FALSE
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Count","SWECount",TRUE
-"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","CountRange","<missing>",FALSE
+"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","CountRange","SWECountRange",TRUE
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","DataArray","<missing>",FALSE
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","DataChoice","<missing>",FALSE
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","DataRecord","<missing>",FALSE
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","DataStream","<missing>",FALSE
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Matrix","<missing>",FALSE
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","NilValues","<missing>",FALSE
-"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Quantity","<missing>",FALSE
+"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Quantity","SWEQuantity",TRUE
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","QuantityRange","SWEQuantityRange",TRUE
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Text","SWEText",TRUE
 "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","TextEncoding","<missing>",FALSE
diff --git a/inst/extdata/coverage/geometa_coverage_summary.csv b/inst/extdata/coverage/geometa_coverage_summary.csv
index 78c1d6b9..06b930ff 100644
--- a/inst/extdata/coverage/geometa_coverage_summary.csv
+++ b/inst/extdata/coverage/geometa_coverage_summary.csv
@@ -8,4 +8,4 @@
 "GML 3.2.1 (ISO 19136)","Geographic Markup Language","GML",63,106,37.28
 "GML 3.2.1 Coverage (OGC GMLCOV)","OGC GML Coverage Implementation Schema","GMLCOV",1,0,100
 "GML 3.3 Referenceable Grid (OGC GML)","OGC GML Referenceable Grid","GMLRGRID",5,0,100
-"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE",7,23,23.33
+"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE",10,20,33.33
diff --git a/inst/extdata/coverage/geometa_coverage_summary.md b/inst/extdata/coverage/geometa_coverage_summary.md
index d551ad98..bb463940 100644
--- a/inst/extdata/coverage/geometa_coverage_summary.md
+++ b/inst/extdata/coverage/geometa_coverage_summary.md
@@ -9,4 +9,4 @@
 |GML 3.2.1 (ISO 19136)                |Geographic Markup Language                                                          |GML       |[![GML 3.2.1 (ISO 19136)](https://img.shields.io/badge/-37%25-ff0c0c.svg)](https://github.com/eblondel/geometa)                 |        63|     106|
 |GML 3.2.1 Coverage (OGC GMLCOV)      |OGC GML Coverage Implementation Schema                                              |GMLCOV    |[![GML 3.2.1 Coverage (OGC GMLCOV)](https://img.shields.io/badge/-100%25-4a4ea8.svg)](https://github.com/eblondel/geometa)      |         1|       0|
 |GML 3.3 Referenceable Grid (OGC GML) |OGC GML Referenceable Grid                                                          |GMLRGRID  |[![GML 3.3 Referenceable Grid (OGC GML)](https://img.shields.io/badge/-100%25-4a4ea8.svg)](https://github.com/eblondel/geometa) |         5|       0|
-|SWE 2.0                              |Sensor Web Enablement (SWE) Common Data Model                                       |SWE       |[![SWE 2.0](https://img.shields.io/badge/-23%25-ff0c0c.svg)](https://github.com/eblondel/geometa)                               |         7|      23|
+|SWE 2.0                              |Sensor Web Enablement (SWE) Common Data Model                                       |SWE       |[![SWE 2.0](https://img.shields.io/badge/-33%25-ff0c0c.svg)](https://github.com/eblondel/geometa)                               |        10|      20|
diff --git a/man/SWECategory.Rd b/man/SWECategory.Rd
new file mode 100644
index 00000000..907a999f
--- /dev/null
+++ b/man/SWECategory.Rd
@@ -0,0 +1,54 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/SWECategory.R
+\docType{class}
+\name{SWECategory}
+\alias{SWECategory}
+\title{SWECategory}
+\format{
+\code{\link{R6Class}} object.
+}
+\arguments{
+\item{xml}{object of class \link{XMLInternalNode-class} from \pkg{XML}}
+
+\item{updatable}{updatable}
+
+\item{optional}{optional}
+
+\item{definition}{definition}
+
+\item{codeSpace}{codeSpace}
+
+\item{constraint}{constraint}
+
+\item{value}{value}
+}
+\value{
+Object of \code{\link{R6Class}} for modelling an SWE Category
+}
+\description{
+Initializes an object of class \link{SWECategory}
+
+setCodeSpace
+
+setConstraint
+
+setValue
+}
+\section{Fields}{
+
+\describe{
+\item{\code{codeSpace}}{codeSpace}
+
+\item{\code{constraint}}{constraint}
+
+\item{\code{value}}{value}
+}}
+
+\references{
+OGC Geography Markup Language. https://www.ogc.org/standards/swecommon
+}
+\author{
+Emmanuel Blondel <emmanuel.blondel1@gmail.com>
+}
+\keyword{ISO}
+\keyword{SWE}
diff --git a/man/SWECountRange.Rd b/man/SWECountRange.Rd
new file mode 100644
index 00000000..a685fa00
--- /dev/null
+++ b/man/SWECountRange.Rd
@@ -0,0 +1,48 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/SWECountRange.R
+\docType{class}
+\name{SWECountRange}
+\alias{SWECountRange}
+\title{SWECountRange}
+\format{
+\code{\link{R6Class}} object.
+}
+\arguments{
+\item{xml}{object of class \link{XMLInternalNode-class} from \pkg{XML}}
+
+\item{updatable}{updatable}
+
+\item{optional}{optional}
+
+\item{definition}{definition}
+
+\item{constraint}{constraint}
+
+\item{value}{value}
+}
+\value{
+Object of \code{\link{R6Class}} for modelling an SWE CountRange
+}
+\description{
+Initializes an object of class \link{SWECountRange}
+
+setConstraint
+
+setValue
+}
+\section{Fields}{
+
+\describe{
+\item{\code{constraint}}{constraint}
+
+\item{\code{value}}{value}
+}}
+
+\references{
+OGC Geography Markup Language. https://www.ogc.org/standards/swecommon
+}
+\author{
+Emmanuel Blondel <emmanuel.blondel1@gmail.com>
+}
+\keyword{ISO}
+\keyword{SWE}
diff --git a/man/SWEQuantity.Rd b/man/SWEQuantity.Rd
new file mode 100644
index 00000000..b6c5f6b9
--- /dev/null
+++ b/man/SWEQuantity.Rd
@@ -0,0 +1,54 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/SWEQuantity.R
+\docType{class}
+\name{SWEQuantity}
+\alias{SWEQuantity}
+\title{SWEQuantity}
+\format{
+\code{\link{R6Class}} object.
+}
+\arguments{
+\item{xml}{object of class \link{XMLInternalNode-class} from \pkg{XML}}
+
+\item{updatable}{updatable}
+
+\item{optional}{optional}
+
+\item{definition}{definition}
+
+\item{uom}{uom}
+
+\item{constraint}{constraint}
+
+\item{value}{value}
+}
+\value{
+Object of \code{\link{R6Class}} for modelling an SWE Quantity
+}
+\description{
+Initializes an object of class \link{SWEQuantity}
+
+setUom
+
+setConstraint
+
+setValue
+}
+\section{Fields}{
+
+\describe{
+\item{\code{uom}}{uom}
+
+\item{\code{constraint}}{constraint}
+
+\item{\code{value}}{value}
+}}
+
+\references{
+OGC Geography Markup Language. https://www.ogc.org/standards/swecommon
+}
+\author{
+Emmanuel Blondel <emmanuel.blondel1@gmail.com>
+}
+\keyword{ISO}
+\keyword{SWE}
diff --git a/tests/testthat/test_SWECategory.R b/tests/testthat/test_SWECategory.R
new file mode 100644
index 00000000..3b71ef88
--- /dev/null
+++ b/tests/testthat/test_SWECategory.R
@@ -0,0 +1,23 @@
+# test_SWECategory.R
+# Author: Emmanuel Blondel <emmanuel.blondel1@gmail.com>
+#
+# Descategiption: Unit tests for classes inheriting SWECategory.R
+#=======================
+require(geometa, quietly = TRUE)
+require(sf)
+require(testthat)
+
+context("SWECategory")
+
+test_that("SWECategory",{
+  testthat::skip_on_categan()
+  #encoding
+  categ <- SWECategory$new(value = "string1")
+  xml <- categ$encode()
+  expect_is(xml, "XMLInternalNode")
+  #decoding
+  categ2 <- SWECategory$new(xml = xml)
+  xml2 <- categ2$encode()
+  #assert object identity
+  expect_true(ISOAbstractObject$compare(categ, categ2))
+})
diff --git a/tests/testthat/test_SWEQuantity.R b/tests/testthat/test_SWEQuantity.R
new file mode 100644
index 00000000..b90f48b3
--- /dev/null
+++ b/tests/testthat/test_SWEQuantity.R
@@ -0,0 +1,23 @@
+# test_SWEQuantity.R
+# Author: Emmanuel Blondel <emmanuel.blondel1@gmail.com>
+#
+# Description: Unit tests for classes inheriting SWEQuantity.R
+#=======================
+require(geometa, quietly = TRUE)
+require(sf)
+require(testthat)
+
+context("SWEQuantity")
+
+test_that("SWEQuantity",{
+  testthat::skip_on_cran()
+  #encoding
+  q <- SWEQuantity$new(value = 2.56)
+  xml <- q$encode()
+  expect_is(xml, "XMLInternalNode")
+  #decoding
+  q2 <- SWEQuantity$new(xml = xml)
+  xml2 <- q2$encode()
+  #assert object identity
+  expect_true(ISOAbstractObject$compare(q, q2))
+})
diff --git a/tests/testthat/test_SWeCountRange.R b/tests/testthat/test_SWeCountRange.R
new file mode 100644
index 00000000..361786ff
--- /dev/null
+++ b/tests/testthat/test_SWeCountRange.R
@@ -0,0 +1,23 @@
+# test_SWECountRange.R
+# Author: Emmanuel Blondel <emmanuel.blondel1@gmail.com>
+#
+# Description: Unit tests for classes inheriting SWECountRange.R
+#=======================
+require(geometa, quietly = TRUE)
+require(sf)
+require(testthat)
+
+context("SWECountRange")
+
+test_that("SWECountRange",{
+  testthat::skip_on_cran()
+  #encoding
+  cr <- SWECountRange$new(value = matrix(c(0,1),1,2))
+  xml <- cr$encode()
+  expect_is(xml, "XMLInternalNode")
+  #decoding
+  cr2 <- SWECountRange$new(xml = xml)
+  xml2 <- cr2$encode()
+  #assert object identity
+  expect_true(ISOAbstractObject$compare(cr, cr2))
+})