From eba72d0c943001e1695896242d9a5015328d1fc9 Mon Sep 17 00:00:00 2001
From: Luiz Scheinkman <lscheinkman@numenta.com>
Date: Tue, 9 Jan 2018 23:52:02 -0800
Subject: [PATCH] Issue #1380: Add SP test checking results with no learning
 and 0 boosting

---
 src/test/unit/algorithms/SpatialPoolerTest.cpp | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/test/unit/algorithms/SpatialPoolerTest.cpp b/src/test/unit/algorithms/SpatialPoolerTest.cpp
index 88f3882a2e..6b8ba7eb99 100644
--- a/src/test/unit/algorithms/SpatialPoolerTest.cpp
+++ b/src/test/unit/algorithms/SpatialPoolerTest.cpp
@@ -2222,6 +2222,23 @@ namespace {
     EXPECT_EQ(0, countNonzero(activeColumns));
   }
 
+
+  TEST(SpatialPoolerTest, testSameOutputForSameInputNoLearningNoBoosting)
+  {
+    const UInt inputSize = 10;
+    const UInt nColumns = 20;
+    SpatialPooler sp;
+    sp.initialize({inputSize}, {nColumns});
+    sp.setBoostStrength(0);
+
+    vector<UInt> input = { 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 };
+    vector<UInt> out1(nColumns, 0);
+    vector<UInt> out2(nColumns, 0);
+    sp.compute(input.data(), false, out1.data());
+    sp.compute(input.data(), false, out2.data());
+    EXPECT_EQ(out1, out2);
+  }
+
   TEST(SpatialPoolerTest, testSaveLoad)
   {
     const char* filename = "SpatialPoolerSerialization.tmp";