[CHNOSZ-commits] r961 - in pkg/CHNOSZ: . inst/tinytest

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 11 02:20:26 CET 2026


Author: jedick
Date: 2026-01-11 02:20:24 +0100 (Sun, 11 Jan 2026)
New Revision: 961

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/inst/tinytest/test-util.units.R
Log:
Add tests for convert()


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2026-01-10 10:04:22 UTC (rev 960)
+++ pkg/CHNOSZ/DESCRIPTION	2026-01-11 01:20:24 UTC (rev 961)
@@ -1,6 +1,6 @@
-Date: 2026-01-10
+Date: 2026-01-11
 Package: CHNOSZ
-Version: 2.2.0-27
+Version: 2.2.0-28
 Title: Thermodynamic Calculations and Diagrams for Geochemistry
 Authors at R: c(
     person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),

Modified: pkg/CHNOSZ/inst/tinytest/test-util.units.R
===================================================================
--- pkg/CHNOSZ/inst/tinytest/test-util.units.R	2026-01-10 10:04:22 UTC (rev 960)
+++ pkg/CHNOSZ/inst/tinytest/test-util.units.R	2026-01-11 01:20:24 UTC (rev 961)
@@ -5,3 +5,26 @@
 expect_error(P.units("X"), "units of pressure must be either bar or MPa", info = info)
 expect_error(T.units("X"), "units of temperature must be either C or K", info = info)
 expect_error(E.units("X"), "units of energy must be either cal or J", info = info)
+
+# Tests added on 20260111
+
+info <- "Error with non-character units specification"
+expect_error(convert(25, 1), "please specify a character argument", info = info)
+
+info <- "Expected results with solubility() output"
+
+# Solubility of gaseous SO2
+basis(c("sulfur", "oxygen", "H2O", "H+"))
+basis("O2", -56)
+basis("pH", 6)
+species("sulfur dioxide", -20)
+iaq <- retrieve("S", c("O", "H"), "aq")
+s <- solubility(iaq, T = 125, in.terms.of = "S")
+
+expect_equal(round(convert(s, "ppt")$loga.balance[[1]]), 3, info = info)
+expect_equal(round(convert(s, "ppm")$loga.balance[[1]]), 3054, info = info)
+expect_equal(round(convert(s, "ppb")$loga.balance[[1]]), 3054344, info = info)
+expect_equal(round(convert(s, "logppb")$loga.balance[[1]]), round(log10(3054344)), info = info)
+expect_error(convert(s, 1), "please specify a character argument", info = info)
+expect_error(convert(s, "ppx"), "units ppx not available", info = info)
+expect_error(convert(s[-1], "ppb"), "is not the output from solubility()", info = info)



More information about the CHNOSZ-commits mailing list