@@ -112,7 +112,7 @@ TEST(CppRegionTest, testCppLinkingSDR) {
112112 Network net;
113113
114114 std::shared_ptr<Region> region1 = net.addRegion (" region1" , " ScalarSensor" , " {dim: [6,1], n: 6, w: 2}" );
115- std::shared_ptr<Region> region2 = net.addRegion (" region2" , " SPRegion" , " {dim: [2 ,3]}" );
115+ std::shared_ptr<Region> region2 = net.addRegion (" region2" , " SPRegion" , " {dim: [20 ,3]}" );
116116
117117 net.link (" region1" , " region2" );
118118
@@ -130,7 +130,7 @@ TEST(CppRegionTest, testCppLinkingSDR) {
130130 const Array r1OutputArray = region1->getOutputData (" encoded" );
131131 VERBOSE << r1OutputArray << " \n " ;
132132 std::vector<Byte> expected = {0 , 0 , 0 , 0 , 1 , 1 };
133- EXPECT_TRUE (r1OutputArray == expected);
133+ EXPECT_EQ (r1OutputArray, expected);
134134
135135 region2->prepareInputs ();
136136 region2->compute ();
@@ -139,22 +139,24 @@ TEST(CppRegionTest, testCppLinkingSDR) {
139139 const Array r2InputArray = region2->getInputData (" bottomUpIn" );
140140 VERBOSE << r2InputArray << " \n " ;
141141 EXPECT_EQ (r2InputArray.getType (), NTA_BasicType_SDR);
142- EXPECT_TRUE (r2InputArray == expected);
142+ EXPECT_EQ (r2InputArray, expected);
143143
144144 VERBOSE << " Region 2 input after first iteration:" << std::endl;
145145 const Dimensions r2dims = region2->getOutput (" bottomUpOut" )->getDimensions ();
146146 EXPECT_EQ (r2dims.size (), 2u ) << " actual dims: " << r2dims.toString ();
147- EXPECT_EQ (r2dims[0 ], 2u ) << " actual dims: " << r2dims.toString ();
147+ EXPECT_EQ (r2dims[0 ], 20u ) << " actual dims: " << r2dims.toString (); // match dims of SPRegion constructed above
148148 EXPECT_EQ (r2dims[1 ], 3u ) << " actual dims: " << r2dims.toString ();
149149
150150 const Array r2OutputArray = region2->getOutputData (" bottomUpOut" );
151151 EXPECT_EQ (r2OutputArray.getType (), NTA_BasicType_SDR);
152152 EXPECT_EQ (r2OutputArray.getSDR ().dimensions , r2dims)
153153 << " Expected dimensions on the output to match dimensions on the buffer." ;
154154 VERBOSE << r2OutputArray << " \n " ;
155- std::vector<Byte> expected_output = {1 , 0 , 1 , 0 , 1 , 0 };
156- EXPECT_TRUE (r2OutputArray == expected_output) << " expected " << r2OutputArray;
157-
155+ SDR exp ({20u , 3u });
156+ exp.setSparse (SDR_sparse_t{
157+ 4 , 21 , 32 , 46
158+ });
159+ EXPECT_EQ (r2OutputArray, exp.getDense ()) << " got " << r2OutputArray;
158160}
159161
160162
0 commit comments