Index | Thread | Search

From:
Christian Ludwig <christian_ludwig@genua.de>
Subject:
regress/btrace: Adapt test for associated arrays
To:
<tech@openbsd.org>
Date:
Fri, 2 Feb 2024 16:24:37 +0100

Download raw body.

Thread
  • Christian Ludwig:

    regress/btrace: Adapt test for associated arrays

There was a bug in the code for tuples as map entries that got fixed
with btrace.c,v 1.82 already. Modify the 'map' regress test case so that
it exercises that code.
---
 regress/usr.sbin/btrace/map.bt | 8 ++++----
 regress/usr.sbin/btrace/map.ok | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/regress/usr.sbin/btrace/map.bt b/regress/usr.sbin/btrace/map.bt
index cf6fd7f3f16..1f725961fc8 100644
--- a/regress/usr.sbin/btrace/map.bt
+++ b/regress/usr.sbin/btrace/map.bt
@@ -1,6 +1,6 @@
 BEGIN
 {
-	@map[8 - 1] = count();
+	@map[8 - 1, "test"] = count();
 	printf("=> Print with one element\n");
 	print(@map);
 
@@ -8,7 +8,7 @@ BEGIN
 	printf("=> Print after zero:\n");
 	print(@map);
 
-	@map[7] = count();
+	@map[7, "test"] = count();
 	@map[5] = 42;
 	@map[3 + 1] = 9999;
 	@map[897123] = 9997;
@@ -17,12 +17,12 @@ BEGIN
 	print(@map, @top);
 
 	printf("=> Using printf:\n");
-	printf("%d + %d\n", @map[4], @map[7]);
+	printf("%d + %d\n", @map[4], @map[7, "test"]);
 }
 
 END
 {
-	@map[7] = count();
+	@map[7, "test"] = count();
 	printf("=> Print all map:\n");
 	print(@map);
 
diff --git a/regress/usr.sbin/btrace/map.ok b/regress/usr.sbin/btrace/map.ok
index 4bba4dae8b6..97db21fdff2 100644
--- a/regress/usr.sbin/btrace/map.ok
+++ b/regress/usr.sbin/btrace/map.ok
@@ -1,7 +1,7 @@
 => Print with one element
-@map[7]: 1
+@map[7, test]: 1
 => Print after zero:
-@map[7]: 0
+@map[7, test]: 0
 => Print top 2:
 @map[4]: 9999
 @map[897123]: 9997
@@ -11,5 +11,5 @@
 @map[4]: 9999
 @map[897123]: 9997
 @map[5]: 42
-@map[7]: 2
+@map[7, test]: 2
 => Print after clear:
-- 
2.34.1