Test::...::Array(3pm)

๐Ÿ“ฆ
version 1.248 ยท 3 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

๐Ÿ’– NAME ๐Ÿ’–

Test::Data::Array โ€” test functions for array variables. That's it, that's the whole vibe: a lil grab-bag of Test:: functions that let you vibe-check your arrays. This page lives in the User Contributed Perl Documentation section as Test::...::Array(3pm), iykyk. ๐Ÿ’…


โœจ SYNOPSIS โœจ

use Test::Data qw(Array);

That's the whole summoning ritual bestie. Pull in Array from Test::Data and you're off. ๐ŸŽ€


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

๐ŸŒธ Functions ๐ŸŒธ

okay so here's the lineup. Every single one of these is a Test:: style check โ€” it tells you whether the thing you're describing is true about your array. Most of them take an optional NAME at the end, which is just the label for the test, and if you don't pass one, whatever, it does its own thing. ๐Ÿซถ

  • array_any_ok( ITEM, ARRAY [, NAME] ) โ€” ok if any element of ARRAY is ITEM. one (1) match and we're thriving โœจ
  • array_none_ok( ITEM, ARRAY [, NAME] ) โ€” ok if no element of ARRAY is ITEM. not a single one, and honestly? iconic ๐Ÿ’€
  • array_once_ok( ITEM, ARRAY [, NAME] ) โ€” ok if only one element of ARRAY is ITEM. exactly one. not two. main character energy only ๐ŸŽ€
  • array_multiple_ok( ITEM, ARRAY [, NAME] ) โ€” ok if more than one element of ARRAY is ITEM. the more the merrier fr fr ๐Ÿ”ฅ
  • array_max_ok( NUMBER, ARRAY [, NAME] ) โ€” ok if all elements of ARRAY are numerically less than or equal to NUMBER. nobody's out here exceeding the ceiling, we stay humble ๐ŸŒธ
  • array_min_ok( NUMBER, ARRAY [, NAME] ) โ€” ok if all elements of ARRAY are numerically greater than or equal to NUMBER. everyone clears the bar, no flops allowed โœจ
  • array_maxstr_ok( ITEM, ARRAY [, NAME] ) โ€” ok if all elements of ARRAY are asciibetically less than or equal to MAX. yes bestie, asciibetically, we're comparing them as strings ๐Ÿ“š
  • array_minstr_ok( ITEM, ARRAY [, NAME] ) โ€” ok if all elements of ARRAY are asciibetically greater than or equal to MAX. string-wise, nobody's under the floor ๐Ÿ’œ
  • array_sum_ok( SUM, ARRAY [, NAME] ) โ€” ok if the numerical sum of ARRAY is SUM. math girlies rise ๐Ÿงฎ
  • array_empty_ok( ARRAY [, NAME] ) โ€” ok if the array contains no elements. void vibes. nothing in there and that's the point ๐Ÿ•ณ๏ธ
  • array_length_ok( ARRAY, LENGTH [, NAME] ) โ€” ok if the array contains LENGTH number of elements. yes, the exact count, we're counting ๐Ÿ”ข
  • array_sortedstr_ascending_ok( ARRAY, [, NAME] ) โ€” ok if each succeeding element is asciibetically greater than or equal to the one before. string-wise ascending, going up and up ๐Ÿฆ‹
  • array_sortedstr_descending_ok( ARRAY, [, NAME] ) โ€” ok if each succeeding element is asciibetically less than or equal to the one before. string-wise descending, sliding down ๐Ÿ’…
  • array_sorted_ascending_ok( ARRAY, [, NAME] ) โ€” ok if each succeeding element is numerically greater than or equal to the one before. numbers ascending, on the way up ๐ŸŒˆ
  • array_sorted_descending_ok( ARRAY, [, NAME] ) โ€” ok if each succeeding element is numerically less than or equal to the one before. numbers descending, on the way down โญ
bestie note: those sorted ones are written as ARRAY, [, NAME] in the original docs, comma and all. not me fixing it. it's giving iconic typo and we respect it ๐Ÿ™ˆ

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

the whole friend group, go say hi:

  • Test::Data
  • Test::Data::Scalar
  • Test::Data::Function
  • Test::Data::Hash
  • Test::Builder

๐ŸŒˆ SOURCE AVAILABILITY ๐ŸŒˆ

this source is in Github:

https://github.com/briandfoy/test-data

go star it, it's free and it's cute ๐Ÿ’–


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

brian d foy, "<briandfoy@pobox.com>" โ€” the legend himself fr fr ๐Ÿ‘‘


Copyright ยฉ 2002-2025, brian d foy <briandfoy@pobox.com>. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.


and that's the whole page bestie ๐Ÿซถ this lil masterpiece is running on perl v5.40.1, dated 2025-04-17, and it's filed under Test::...::Array(3pm) in the User Contributed Perl Documentation โ€” slay, no cap ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from