diff tests/farray-misc.t @ 761:c14c7b5b5fea

farray.sh: Make parsing of storage pointers stricter; disallow "octal" numbers. While there: add unittests for storage pointers.
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 20 Oct 2024 18:38:12 +0200
parents cf0f18d3d41b
children
line wrap: on
line diff
--- a/tests/farray-misc.t	Sun Oct 20 16:33:20 2024 +0200
+++ b/tests/farray-misc.t	Sun Oct 20 18:38:12 2024 +0200
@@ -43,6 +43,8 @@
   [1]
   $ _farr_is_decimal_number '0x1'
   [1]
+  $ _farr_is_decimal_number '/'
+  [1]
   $ _farr_is_decimal_number *12345678901234567890
   [1]
   $ _farr_is_decimal_number 0x0123456789abcdef
@@ -103,3 +105,46 @@
   $ ( _farr_make_index _res 0 0x1 )
   ERROR: given length is not a valid decimal number
   [70]
+
+
+Storage Pointer Checks
+======================
+
+No empty (null) values
+
+  $ _farr_is_valid_storage_ptr ''
+  [1]
+
+The NULL pointer (aka s single 0 character) is allowed
+
+  $ _farr_is_valid_storage_ptr 0
+
+Non-decimal charactesr are not allowed
+
+  $ _farr_is_valid_storage_ptr f12345
+  [1]
+
+  $ _farr_is_valid_storage_ptr a
+  [1]
+
+  $ _farr_is_valid_storage_ptr '/'
+  [1]
+
+"Octal" numbers are not allowed
+
+  $ _farr_is_valid_storage_ptr 01
+  [1]
+
+Some valid numbers
+
+  $ _farr_is_valid_storage_ptr 1
+  $ _farr_is_valid_storage_ptr 2
+  $ _farr_is_valid_storage_ptr 3
+  $ _farr_is_valid_storage_ptr 4
+  $ _farr_is_valid_storage_ptr 5
+  $ _farr_is_valid_storage_ptr 6
+  $ _farr_is_valid_storage_ptr 7
+  $ _farr_is_valid_storage_ptr 8
+  $ _farr_is_valid_storage_ptr 9
+
+  $ _farr_is_valid_storage_ptr 12345678901234567890