add hist() tests similar to mapempty.bt
authorjasper <jasper@openbsd.org>
Thu, 9 Sep 2021 19:02:50 +0000 (19:02 +0000)
committerjasper <jasper@openbsd.org>
Thu, 9 Sep 2021 19:02:50 +0000 (19:02 +0000)
ok mpi@

regress/usr.sbin/btrace/Makefile
regress/usr.sbin/btrace/histempty.bt [new file with mode: 0644]
regress/usr.sbin/btrace/histempty.ok [new file with mode: 0644]

index cd553a3..bbe1807 100644 (file)
@@ -1,10 +1,11 @@
-# $OpenBSD: Makefile,v 1.19 2021/09/09 10:00:04 mpi Exp $
+# $OpenBSD: Makefile,v 1.20 2021/09/09 19:02:50 jasper Exp $
 
 BTRACE?=                /usr/sbin/btrace
 ALLOWDT!=              sysctl -n kern.allowdt
 
 # scripts that don't need /dev/dt
-BT_LANG_SCRIPTS=       arithm beginend boolean comments delete exit if \
+BT_LANG_SCRIPTS=       arithm beginend boolean comments delete exit \
+                       histempty if \
                        map mapclear mapempty mapsyntax mapzero map-unnamed \
                        maxoperand min+max+sum multismts nsecs+var \
                        precedence print read-map-after-clear syntaxerror
diff --git a/regress/usr.sbin/btrace/histempty.bt b/regress/usr.sbin/btrace/histempty.bt
new file mode 100644 (file)
index 0000000..b8842e6
--- /dev/null
@@ -0,0 +1,18 @@
+BEGIN
+{
+        @histmap = hist(1);
+        print(@histmap);
+}
+
+END
+{
+        clear(@histmap);
+        printf("=> clear() after clear:\n");
+        clear(@histmap);
+        printf("=> delete() after clear:\n");
+        delete(@histmap[0]);
+        printf("=> zero() after clear:\n");
+        zero(@histmap);
+        print(@histmap);
+
+}
diff --git a/regress/usr.sbin/btrace/histempty.ok b/regress/usr.sbin/btrace/histempty.ok
new file mode 100644 (file)
index 0000000..1f9a3d7
--- /dev/null
@@ -0,0 +1,5 @@
+@h:
+[0, 1)             1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
+=> clear() after clear:
+=> delete() after clear:
+=> zero() after clear: