From 2e7b0869d0890ebaae063f9824658ae79c4e27b6 Mon Sep 17 00:00:00 2001
From: BenceJanosSzabo <bence.janos.szabo@ericsson.com>
Date: Wed, 23 Aug 2017 09:21:46 +0200
Subject: [PATCH] Corrected isbound() for arrays (Bug 521245)

Change-Id: I0381e67943b89e2f7fcfe9505c827b244d550414
Signed-off-by: BenceJanosSzabo <bence.janos.szabo@ericsson.com>
---
 core/Array.hh                             | 6 +++---
 regression_test/arrayOper/TarrayOper.ttcn | 5 ++---
 regression_test/text2ttcn/array_test.ttcn | 6 +++---
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/core/Array.hh b/core/Array.hh
index 1d39b195f..62fc25c9e 100644
--- a/core/Array.hh
+++ b/core/Array.hh
@@ -1128,11 +1128,11 @@ template <typename T_type, unsigned int array_size, int index_offset>
 boolean VALUE_ARRAY<T_type,array_size,index_offset>::is_bound() const
 {
   for (unsigned int i = 0; i < array_size; ++i) {
-    if (!array_elements[i].is_bound()) {
-    	return FALSE;
+    if (array_elements[i].is_bound()) {
+    	return TRUE;
     }
   }
-  return TRUE;
+  return FALSE;
 }
 
 template <typename T_type, unsigned int array_size, int index_offset>
diff --git a/regression_test/arrayOper/TarrayOper.ttcn b/regression_test/arrayOper/TarrayOper.ttcn
index f5fb7d71a..c7b8fddd1 100644
--- a/regression_test/arrayOper/TarrayOper.ttcn
+++ b/regression_test/arrayOper/TarrayOper.ttcn
@@ -392,9 +392,8 @@ if (not(ischosen(x1[1].x1))) {setverdict(pass);}
      else {setverdict(fail);}
 if (x2[2].x2==1.4) {setverdict(pass);}		//out of order
      else {setverdict(fail);}
-/* Temporarily disabled: Bug 521245 */ 
-/*if (ischosen(x2[2].x2)) {setverdict(pass);}
-     else {setverdict(fail);}*/
+if (ischosen(x2[2].x2)) {setverdict(pass);}
+     else {setverdict(fail);}
 if (not(ischosen(x2[2].x1))) {setverdict(pass);}
      else {setverdict(fail);}
 }
diff --git a/regression_test/text2ttcn/array_test.ttcn b/regression_test/text2ttcn/array_test.ttcn
index 6635ae441..537884f39 100644
--- a/regression_test/text2ttcn/array_test.ttcn
+++ b/regression_test/text2ttcn/array_test.ttcn
@@ -197,7 +197,7 @@ function f_string2ttcn_REC_BAI3_v_str(in charstring pl_cs, charstring pl_expecte
       log("str2ttcn() failed: ",err_str);
       setverdict(fail);
     }
-    if( pl_expected_result == log2str(vl_result) ) { setverdict(pass) } else { setverdict(fail) }
+    if( pl_expected_result == log2str(vl_result) ) { setverdict(pass) } else { setverdict(fail, match(pl_expected_result, log2str(vl_result))) }
   } 
   else 
   {
@@ -744,7 +744,7 @@ testcase tc_array_string2ttcn_i3_mod4v1() runs on MC {
   f_string2ttcn_REC_BAI3_t_str("{ b := true, ai3 := { 1, -, - } }", "{ b := true, ai3 := { 1, <uninitialized template>, <uninitialized template> } }")
   //f_string2ttcn_REC_BAI3_v_str("{ b := true, ai3 := { 1, -, - } }", log2str(vl_rec),true)
   // partial array values are currently deleted if the array is an optional field or a union alternative (see artf708493)
-  f_string2ttcn_REC_BAI3_v_str("{ b := true, ai3 := { 1, -, - } }", "{ b := true, ai3 := <unbound> }" , true);
+  f_string2ttcn_REC_BAI3_v_str("{ b := true, ai3 := { 1, -, - } }", "{ b := true, ai3 := { 1, <unbound>, <unbound> } }" , true);
   log(tl_rec);
   log(vl_rec);
 }
@@ -755,7 +755,7 @@ testcase tc_array_string2ttcn_i3_mod4v2() runs on MC {
   f_string2ttcn_REC_BAI3_t_str("{ b := true, ai3 := { 1, 2, - } }", "{ b := true, ai3 := { 1, 2, <uninitialized template> } }")
   //f_string2ttcn_REC_BAI3_v_str("{ b := true, ai3 := { 1, 2, - } }", log2str(vl_rec), true);
   // partial array values are currently deleted if the array is an optional field or a union alternative (see artf708493)
-  f_string2ttcn_REC_BAI3_v_str("{ b := true, ai3 := { 1, 2, - } }", "{ b := true, ai3 := <unbound> }" , true);
+  f_string2ttcn_REC_BAI3_v_str("{ b := true, ai3 := { 1, 2, - } }", "{ b := true, ai3 := { 1, 2, <unbound> } }" , true);
   log(tl_rec);
   log(vl_rec);
 }
-- 
GitLab