@@ -351,7 +351,8 @@ void UnitTestTableSequentialInt32(bool binary) {
351351 k2.push_back (sbr.Key ());
352352 v2.push_back (sbr.Value ());
353353 }
354- KALDI_ASSERT (sbr.Close ());
354+ ans = sbr.Close ();
355+ KALDI_ASSERT (ans);
355356 KALDI_ASSERT (k2 == k);
356357 KALDI_ASSERT (v2 == v);
357358}
@@ -384,7 +385,8 @@ void UnitTestTableSequentialBool(bool binary) {
384385 k2.push_back (sbr.Key ());
385386 v2.push_back (sbr.Value ());
386387 }
387- KALDI_ASSERT (sbr.Close ());
388+ ans = sbr.Close ();
389+ KALDI_ASSERT (ans);
388390 KALDI_ASSERT (k2 == k);
389391 KALDI_ASSERT (v2 == v);
390392}
@@ -418,7 +420,8 @@ void UnitTestTableSequentialDouble(bool binary) {
418420 k2.push_back (sbr.Key ());
419421 v2.push_back (sbr.Value ());
420422 }
421- KALDI_ASSERT (sbr.Close ());
423+ ans = sbr.Close ();
424+ KALDI_ASSERT (ans);
422425 KALDI_ASSERT (k2 == k);
423426 if (binary) {
424427 KALDI_ASSERT (v2 == v);
@@ -462,7 +465,8 @@ void UnitTestTableSequentialDoubleBoth(bool binary, bool read_scp) {
462465 k2.push_back (sbr.Key ());
463466 v2.push_back (sbr.Value ());
464467 }
465- KALDI_ASSERT (sbr.Close ());
468+ ans = sbr.Close ();
469+ KALDI_ASSERT (ans);
466470 KALDI_ASSERT (k2 == k);
467471 if (binary) {
468472 KALDI_ASSERT (v2 == v);
@@ -511,7 +515,8 @@ void UnitTestTableSequentialInt32VectorBoth(bool binary, bool read_scp) {
511515 k2.push_back (sbr.Key ());
512516 v2.push_back (sbr.Value ());
513517 }
514- KALDI_ASSERT (sbr.Close ());
518+ ans = sbr.Close ();
519+ KALDI_ASSERT (ans);
515520 KALDI_ASSERT (k2 == k);
516521 KALDI_ASSERT (v2 == v);
517522}
@@ -551,7 +556,8 @@ void UnitTestTableSequentialInt32PairVectorBoth(bool binary, bool read_scp) {
551556 k2.push_back (sbr.Key ());
552557 v2.push_back (sbr.Value ());
553558 }
554- KALDI_ASSERT (sbr.Close ());
559+ ans = sbr.Close ();
560+ KALDI_ASSERT (ans);
555561 KALDI_ASSERT (k2 == k);
556562 KALDI_ASSERT (v2 == v);
557563}
@@ -594,7 +600,8 @@ void UnitTestTableSequentialInt32VectorVectorBoth(bool binary, bool read_scp) {
594600 k2.push_back (sbr.Key ());
595601 v2.push_back (sbr.Value ());
596602 }
597- KALDI_ASSERT (sbr.Close ());
603+ ans = sbr.Close ();
604+ KALDI_ASSERT (ans);
598605 KALDI_ASSERT (k2 == k);
599606 KALDI_ASSERT (v2 == v);
600607}
@@ -641,7 +648,8 @@ void UnitTestTableSequentialInt32Script(bool binary) {
641648 k2.push_back (sbr.Key ());
642649 v2.push_back (sbr.Value ());
643650 }
644- KALDI_ASSERT (sbr.Close ());
651+ ans = sbr.Close ();
652+ KALDI_ASSERT (ans);
645653
646654 unlink (" tmp.scp" );
647655 for (size_t i = 0 ; i < script.size (); i++) {
@@ -684,7 +692,8 @@ void UnitTestTableSequentialDoubleMatrixBoth(bool binary, bool read_scp) {
684692 k2.push_back (sbr.Key ());
685693 v2.push_back (new Matrix<double >(sbr.Value ()));
686694 }
687- KALDI_ASSERT (sbr.Close ());
695+ ans = sbr.Close ();
696+ KALDI_ASSERT (ans);
688697 KALDI_ASSERT (k2 == k);
689698 if (binary) {
690699 for (size_t i = 0 ; i < v2.size (); i++)
@@ -738,7 +747,8 @@ void UnitTestTableSequentialBaseFloatVectorBoth(bool binary, bool read_scp) {
738747 k2.push_back (sbr.Key ());
739748 v2.push_back (new Vector<BaseFloat>(sbr.Value ()));
740749 }
741- KALDI_ASSERT (sbr.Close ());
750+ ans = sbr.Close ();
751+ KALDI_ASSERT (ans);
742752 KALDI_ASSERT (k2 == k);
743753 if (binary) {
744754 for (size_t i = 0 ; i < v2.size (); i++)
@@ -831,10 +841,11 @@ void UnitTestTableRandomBothDouble(bool binary, bool read_scp,
831841 bool ans = sbr.HasKey (cur_key);
832842 KALDI_ASSERT (ans == true );
833843 }
844+ auto v2 = sbr.Value (cur_key);
834845 if (binary) {
835- KALDI_ASSERT (value == sbr. Value (cur_key) );
846+ KALDI_ASSERT (value == v2 );
836847 } else {
837- KALDI_ASSERT (ApproxEqual (value, sbr. Value (cur_key) ));
848+ KALDI_ASSERT (ApproxEqual (value, v2 ));
838849 }
839850 }
840851 }
@@ -1039,10 +1050,11 @@ void UnitTestTableRandomBothDoubleMatrix(bool binary, bool read_scp,
10391050 bool ans = sbr.HasKey (cur_key);
10401051 KALDI_ASSERT (ans == true );
10411052 }
1053+ auto v2 = sbr.Value (cur_key);
10421054 if (binary) {
1043- KALDI_ASSERT (value_ptr->ApproxEqual (sbr. Value (cur_key) , 1.0e-10 ));
1055+ KALDI_ASSERT (value_ptr->ApproxEqual (v2 , 1.0e-10 ));
10441056 } else {
1045- KALDI_ASSERT (value_ptr->ApproxEqual (sbr. Value (cur_key) , 0.01 ));
1057+ KALDI_ASSERT (value_ptr->ApproxEqual (v2 , 0.01 ));
10461058 }
10471059 }
10481060 }
0 commit comments