[rkward-cvs] SF.net SVN: rkward:[4395] trunk/rkward/packages/XiMpLe
m-eik at users.sourceforge.net
m-eik at users.sourceforge.net
Sat Oct 27 13:50:51 UTC 2012
Revision: 4395
http://rkward.svn.sourceforge.net/rkward/?rev=4395&view=rev
Author: m-eik
Date: 2012-10-27 13:50:50 +0000 (Sat, 27 Oct 2012)
Log Message:
-----------
XiMpLe: adding some tests to the package
Added Paths:
-----------
trunk/rkward/packages/XiMpLe/inst/tests/
trunk/rkward/packages/XiMpLe/inst/tests/koRpus_RSS_sample.xml
trunk/rkward/packages/XiMpLe/inst/tests/sample_RSS_parsed.RData
trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_node_attrs.RData
trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_node_closed_dput.txt
trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_node_empty_dput.txt
trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_node_extracted.RData
trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_tree.RData
trunk/rkward/packages/XiMpLe/inst/tests/tests.R
trunk/rkward/packages/XiMpLe/tests/
trunk/rkward/packages/XiMpLe/tests/test_XiMpLe_package.R
Added: trunk/rkward/packages/XiMpLe/inst/tests/koRpus_RSS_sample.xml
===================================================================
--- trunk/rkward/packages/XiMpLe/inst/tests/koRpus_RSS_sample.xml (rev 0)
+++ trunk/rkward/packages/XiMpLe/inst/tests/koRpus_RSS_sample.xml 2012-10-27 13:50:50 UTC (rev 4395)
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
+ <channel>
+ <title>
+ koRpus
+ </title>
+ <link>
+ http://R.reaktanz.de/pckg/koRpus
+ </link>
+ <atom:link href="http://R.reaktanz.de/pckg/koRpus/RSS.xml" rel="self" type="application/rss+xml" />
+ <description>
+ <![CDATA[ A set of tools to analyze texts. Includes, amongst others, functions for automatic language detection,
+ hyphenation, several indices of lexical diversity (e.g., type token ratio, HD-D/vocd-D, MTLD)
+ and readability (e.g., Flesch, SMOG, LIX, Dale-Chall). Basic import functions for language corpora
+ are also provided, to enable frequency analyses (supports Celex and Leipzig Corpora Collection file formats).
+ #'
+ Note: For full functionality a local installation of TreeTagger is recommended.
+ Be encouraged to send feedback to the author(s)! ]]>
+ </description>
+ <generator>
+ roxyPackage (0.02-3)
+ </generator>
+ <item>
+ <title>
+ Changes in koRpus version 0.04-30
+ </title>
+ <link>
+ http://R.reaktanz.de/pckg/koRpus
+ </link>
+ <pubDate>
+ Thu, 05 Apr 2012 00:00:00 +0000
+ </pubDate>
+ <guid isPermaLink="false">
+ koRpus0.04-30(2012-04-05)
+ </guid>
+ <description>
+ <![CDATA[ <p>
+ <ul>
+ <li>
+ corpus frequency objects now include a column with number of characters ('lttr')
+ </li>
+ <li>
+ <code>
+ query()
+ </code>
+ for corpus frequency objects now returns objects of the same class, to allow nested queries, and 'lttr' can also be queried
+ </li>
+ </ul>
+ </p> ]]>
+ </description>
+ </item>
+ <item>
+ <title>
+ Changes in koRpus version 0.04-29
+ </title>
+ <link>
+ http://R.reaktanz.de/pckg/koRpus
+ </link>
+ <pubDate>
+ Thu, 05 Apr 2012 00:00:00 +0000
+ </pubDate>
+ <guid isPermaLink="false">
+ koRpus0.04-29(2012-04-05)
+ </guid>
+ <description>
+ <![CDATA[ <p>
+ <ul>
+ <li>
+ fixed bug in
+ <code>
+ summary()
+ </code>
+ for tagged objects without punctuation
+ </li>
+ <li>
+ renamed
+ <code>
+ kRp.freq.analysis()
+ </code>
+ to
+ <code>
+ freq.analysis()
+ </code>
+ (with wrapper function for backwards compatibility)
+ </li>
+ <li>
+ <code>
+ readability.num()
+ </code>
+ can now directly digest objects of class kRp.readability
+ </li>
+ <li>
+ data documentation hyph.XX is now a roxygen source file as well
+ </li>
+ <li>
+ cleaned up
+ <code>
+ summary()
+ </code>
+ and
+ <code>
+ show()
+ </code>
+ docs
+ </li>
+ <li>
+ adjustements to the roxygen2 docs (methods)
+ </li>
+ </ul>
+ </p> ]]>
+ </description>
+ </item>
+ </channel>
+</rss>
Added: trunk/rkward/packages/XiMpLe/inst/tests/sample_RSS_parsed.RData
===================================================================
(Binary files differ)
Property changes on: trunk/rkward/packages/XiMpLe/inst/tests/sample_RSS_parsed.RData
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_node_attrs.RData
===================================================================
(Binary files differ)
Property changes on: trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_node_attrs.RData
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_node_closed_dput.txt
===================================================================
--- trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_node_closed_dput.txt (rev 0)
+++ trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_node_closed_dput.txt 2012-10-27 13:50:50 UTC (rev 4395)
@@ -0,0 +1,6 @@
+new("XiMpLe.node"
+ , name = "empty"
+ , attributes = list()
+ , children = list()
+ , value = ""
+)
Added: trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_node_empty_dput.txt
===================================================================
--- trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_node_empty_dput.txt (rev 0)
+++ trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_node_empty_dput.txt 2012-10-27 13:50:50 UTC (rev 4395)
@@ -0,0 +1,6 @@
+new("XiMpLe.node"
+ , name = "empty"
+ , attributes = list()
+ , children = list()
+ , value = character(0)
+)
Added: trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_node_extracted.RData
===================================================================
(Binary files differ)
Property changes on: trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_node_extracted.RData
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_tree.RData
===================================================================
(Binary files differ)
Property changes on: trunk/rkward/packages/XiMpLe/inst/tests/sample_XML_tree.RData
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/rkward/packages/XiMpLe/inst/tests/tests.R
===================================================================
--- trunk/rkward/packages/XiMpLe/inst/tests/tests.R (rev 0)
+++ trunk/rkward/packages/XiMpLe/inst/tests/tests.R 2012-10-27 13:50:50 UTC (rev 4395)
@@ -0,0 +1,77 @@
+context("XML generation")
+
+test_that("generate empty XML node", {
+ sampleXMLStandard <- dget("sample_XML_node_empty_dput.txt")
+ expect_that(
+ XMLNode("empty"),
+ equals(sampleXMLStandard)
+ )
+})
+
+test_that("generate closed XML node", {
+ sampleXMLStandard <- dget("sample_XML_node_closed_dput.txt")
+ expect_that(
+ XMLNode("empty", ""),
+ equals(sampleXMLStandard)
+ )
+})
+
+test_that("generate closed XML node with attributes", {
+ # re-create object sampleXMLnode.attrs
+ load("sample_XML_node_attrs.RData")
+ expect_that(
+ XMLNode("empty", "test", attrs=list(foo="bar")),
+ equals(sampleXMLnode.attrs)
+ )
+})
+
+test_that("generate nested XML tag tree", {
+ # re-create object sampleXMLTree
+ load("sample_XML_tree.RData")
+
+ sampleXMLnode.empty <- XMLNode("empty")
+ sampleXMLnode.closed <- XMLNode("empty", "")
+ sampleXMLnode.attrs <- XMLNode("empty", "test", attrs=list(foo="bar"))
+ sampleXMLTree.test <- XMLTree(
+ XMLNode("tree",
+ sampleXMLnode.empty,
+ sampleXMLnode.closed,
+ sampleXMLnode.attrs
+ )
+ )
+
+ expect_that(
+ sampleXMLTree.test,
+ equals(sampleXMLTree)
+ )
+})
+
+
+context("XML parsing")
+
+test_that("parse XML file", {
+ # re-create object sampleXMLparsed
+ load("sample_RSS_parsed.RData")
+
+ sampleXMLFile <- normalizePath("koRpus_RSS_sample.xml")
+ XMLtoParse <- file(sampleXMLFile, encoding="UTF-8")
+ sampleXMLparsed.test <- parseXMLTree(XMLtoParse)
+ close(XMLtoParse)
+
+ expect_that(
+ sampleXMLparsed.test,
+ equals(sampleXMLparsed))
+})
+
+test_that("extract node from parsed XML tree", {
+ # re-create object sampleXMLparsed
+ load("sample_RSS_parsed.RData")
+ # re-create object sampleXMLnode.extracted
+ load("sample_XML_node_extracted.RData")
+
+ sampleXMLnode.test <- node(sampleXMLparsed, node=list("rss","channel","atom:link"))
+
+ expect_that(
+ sampleXMLnode.test,
+ equals(sampleXMLnode.extracted))
+})
Added: trunk/rkward/packages/XiMpLe/tests/test_XiMpLe_package.R
===================================================================
--- trunk/rkward/packages/XiMpLe/tests/test_XiMpLe_package.R (rev 0)
+++ trunk/rkward/packages/XiMpLe/tests/test_XiMpLe_package.R 2012-10-27 13:50:50 UTC (rev 4395)
@@ -0,0 +1,5 @@
+# the tests are realized using the "testthat" package
+# and can be found in ../inst/tests
+
+require(testthat)
+test_package("XiMpLe")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list