Bracket - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


VerifyTools

  

Bracket

  

create a verification suitable for testing addressable structures

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

VerifyTools:-Bracket(ver)

Parameters

ver

-

verification; verification to bracket

Description

• 

The Bracket command brackets a verification, ver, by converting it to a verification suitable for testing the content of an addressable structure that has been wrapped in list brackets.

• 

Bracket(ver) expands dummy verifications %NULL, seq, and &, in ver, as explained on verify,exprseq.

– 

%NULL verifies empty expression sequences.

– 

seq(ver) verifies expression sequences of ver verifications.

– 

(ver1 &, ver2 &, ver3 ... ) verifies expression sequences using ver1 for the first element, etc.

• 

This procedure is used by the verifications Array, Matrix, Vector, rtable, record, and table, when an optional verification is specified.

Examples

withVerifyTools:

Suppose we want to parametric verification which compares two Vectors, where each entry of the Vector is either NULL or an expression sequence of two entries. In the latter case, we want to compare the first expression of the sequence exactly, and the second expression using the verification passed as a parameter, either the as_set verification, which ignores the order and multiplicity of the results, or the as_list verification which does not.

vVector2:

v11,2,6,4:

v2NULL:

wVector2:

w11,2,4,4,6:

w2NULL:

v,w

1,2,6,4,1,2,4,4,6

(1)

my_verification := proc(v1, v2, ver, $)
   if not (v1 :: Vector and v2 :: Vector) then
     return false;
   elif numelems(v1) <> numelems(v2) then
     return false;
   end if;
   for local i to numelems(v1) do
     if not verify([v1[i]], [v2[i]], Bracket({(truefalse &, ver), %NULL})) then
       return false;
     end if;
   end do;
   return true;
 end proc;

my_verificationprocv1&comma;v2&comma;ver&comma; $locali&semi;ifnotv1::Vectorandv2::Vectorthenreturnfalseelifnumelemsv1<>numelemsv2thenreturnfalseend if&semi;foritonumelemsv1doifnotverifyv1&lsqb;i&rsqb;&comma;v2&lsqb;i&rsqb;&comma;VerifyTools:-Bracket%NULL&comma;truefalse &, verthenreturnfalseend ifend do&semi;returntrueend proc

(2)

AddVerificationmy_Vector&comma;my_verification

verifyv&comma;w&comma;my_Vectoras_set

true

(3)

verifyv&comma;w&comma;my_Vectoras_list

false

(4)

See Also

VerifyTools

VerifyTools[AddVerification]