//--- // povr +ichkPassedMixedArray.inc declare=FailType=0 // 1-5 type fail examples. #version unofficial 3.8; // povr branch only #macro Mcr_id_type(_id) id_type(_id) #end #macro ExpectingMaryDim3OfTypes(_mary) #ifndef (_mary) #error "ExpectingMaryDim3OfTypes:\nArray passed is not defined.\n" #end #if (id_type(_mary) != Mcr_id_type(array)) #error "ExpectingMaryDim3OfTypes:\nToken passed is not an array.\n" #end #if (dimensions(_mary)!=1) #error "ExpectingMaryDim3OfTypes:\nArray passed dimensions !=1.\n" #end #if (dimension_size(_mary,1)!=3) #error "ExpectingMaryDim3OfTypes:\nArray passed dimension size !=3.\n" #end #if (id_type(_mary[0]) != Mcr_id_type(<1,2,3>)) #error "ExpectingMaryDim3OfTypes:\nArray [0] is not 3 dimension vector.\n" #end #if (id_type(_mary[1]) != Mcr_id_type("Star dust falls")) #error "ExpectingMaryDim3OfTypes:\nArray [1] is not a string.\n" #end #if (id_type(_mary[2]) != Mcr_id_type(true)) // booleans really 0,1 floats #error "ExpectingMaryDim3OfTypes:\nArray [2] is not a valid boolean.\n" #else #if ((_mary[2] != 0) & (_mary[2] != 1)) #error "ExpectingMaryDim3OfTypes:\nArray [2] is not a valid boolean.\n" #end #end #if (_mary[2]) #debug concat("Star ",_mary[1]," falling at <",vstr(3,_mary[0],",",9,6),">.\n") #else #debug concat("Star ",_mary[1]," is not falling at <",vstr(3,_mary[0],",",9,6),">.\n") #end #end #declare mAryOK_No = array mixed[3] {<1,2,3>,"dust",no} #declare mAryOK_Yes = array mixed[3] {<1,2,3>,"dust",yes} #declare mAryFloats = 0.123456789; #declare mAryBadVect = array mixed[3] {"star","dust",0} #declare mAryBadStr = array mixed[3] {<1,2,3>,mAryOK_Yes,0} #declare mAryBadBool = array mixed[3] {<1,2,3>,"dust","falls"} #declare mAryBadSize = array mixed[4] {<1,2,3>,"dust","falls","daily"} #debug "\n" ExpectingMaryDim3OfTypes(mAryOK_Yes) #debug "\n" ExpectingMaryDim3OfTypes(mAryOK_No) #debug "\n" //--- Various bad calls #if (FailType = 1) ExpectingMaryDim3OfTypes(mAryFloats) #end #if (FailType = 2) ExpectingMaryDim3OfTypes(mAryBadVect) #end #if (FailType = 3) ExpectingMaryDim3OfTypes(mAryBadStr) #end #if (FailType = 4) ExpectingMaryDim3OfTypes(mAryBadBool) #end #if (FailType = 5) ExpectingMaryDim3OfTypes(mAryBadSize) #end #debug "\n" #error "\n\n========= Parser test. Stop before render ========\n" //---