[mlpack] 09/30: Add serialization test.

Barak A. Pearlmutter barak+git at pearlmutter.net
Mon Dec 26 10:15:26 UTC 2016


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch master
in repository mlpack.

commit 8883bc3722128f609ed85719c0e3a72610fe7d14
Author: Ryan Curtin <ryan at ratml.org>
Date:   Mon Nov 21 14:25:07 2016 -0500

    Add serialization test.
---
 src/mlpack/tests/kernel_test.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/mlpack/tests/kernel_test.cpp b/src/mlpack/tests/kernel_test.cpp
index 783d15a..9e6aa41 100644
--- a/src/mlpack/tests/kernel_test.cpp
+++ b/src/mlpack/tests/kernel_test.cpp
@@ -299,6 +299,20 @@ BOOST_AUTO_TEST_CASE(GaussianKernelTest)
   BOOST_REQUIRE_CLOSE(gk.ConvolutionIntegral(b,c), 0.024304474038457577, 1e-5);
 }
 
+BOOST_AUTO_TEST_CASE(GaussianKernelSerializationTest)
+{
+  GaussianKernel gk(0.5);
+  GaussianKernel xmlGk(1.5), textGk, binaryGk(15.0);
+
+  // Serialize the kernels.
+  SerializeObjectAll(gk, xmlGk, textGk, binaryGk);
+
+  BOOST_REQUIRE_CLOSE(gk.Bandwidth(), 0.5, 1e-5);
+  BOOST_REQUIRE_CLOSE(xmlGk.Bandwidth(), 0.5, 1e-5);
+  BOOST_REQUIRE_CLOSE(textGk.Bandwidth(), 0.5, 1e-5);
+  BOOST_REQUIRE_CLOSE(binaryGk.Bandwidth(), 0.5, 1e-5);
+}
+
 BOOST_AUTO_TEST_CASE(SphericalKernelTest)
 {
   arma::vec a = "1.0 0.0";

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list