diff --git a/r130/inref/zconvert.m b/r130/inref/zconvert.m index 36766dca1..3d1fc24ca 100644 --- a/r130/inref/zconvert.m +++ b/r130/inref/zconvert.m @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; -; Copyright (c) 2019-2020 YottaDB LLC and/or its subsidiaries. ; +; Copyright (c) 2019-2021 YottaDB LLC and/or its subsidiaries. ; ; All rights reserved. ; ; ; ; This source code contains the intellectual property ; @@ -15,9 +15,9 @@ ; DEC to HEX and HEX to DEC conversion is performed using random values of 18 digits as input. ; HEX to DEC and DEC to HEX is performed using random values of 16 digits as input ; Note: hex random values are generated by mapping numbers between 10 and 15 to 'A' and 'F'. - ; Both types of conversion are executed for 15 seconds. - write "Checking DEC to HEX and HEX to DEC conversion of 18 digit random positive numbers for 15 seconds",! - set interval=15000000 ; 15 seconds in mili seconds + ; Both types of conversion are executed for 2 seconds. + write "Checking DEC to HEX and HEX to DEC conversion of 18 digit random positive numbers for 2 seconds",! + set interval=2000000 ; 2 seconds in mili seconds set iend=$zut+interval set istart=1 set maxval=214748364 @@ -38,7 +38,7 @@ . . quit write "Completed",!,! ; - write "Checking HEX to DEC and DEC to HEX conversion of 16 digit random values for 15 seconds",! + write "Checking HEX to DEC and DEC to HEX conversion of 16 digit random values for 2 seconds",! set iend=$zut+interval set istart=1 set inp="" @@ -188,11 +188,11 @@ ; The below routine checks the performance of %DH current implementation with previous implemenation. ; Performance check is being done for both 16 digit and 20 digit input. ; $Random is used to compute input values and that values are passed on to the conversion utility. Same procedure is run -; for 15 seconds in a loop keeping track of number of computations done. +; for 2 seconds in a loop keeping track of number of computations done. ; Expected behavior: current version has higher number of computations than the previous version. compdectohex write "Comparing performance of current %DH implementation vs previous %DH implementation for 16 digit values",! - set interval=15000000 + set interval=2000000 set iend=$zut+interval set istart=1 set ncnt=1 @@ -247,11 +247,11 @@ ; The below routine checks the performance of current version %HD with previous version. ; Performance check is being done for both 14 digit input and 16 digit input as they both lead to different code paths. ; Random is used to compute input value and that value is passed on to the conversion utility. Same procedure is run -; for 15 seconds in a loop keeping track of number of computations done. +; for 2 seconds in a loop keeping track of number of computations done. ; Expected behavior: current version has higher number of computations than the previous version. comphextodec write "Comparing performance of current %HD implementation vs previous %HD implementation with 14 digits",! - set interval=15000000 + set interval=2000000 set iend=$zut+interval set istart=1 set ncnt=1 diff --git a/r130/outref/ydb485.txt b/r130/outref/ydb485.txt index fb335041e..2afbc1413 100644 --- a/r130/outref/ydb485.txt +++ b/r130/outref/ydb485.txt @@ -1,9 +1,9 @@ Testing $ZCONVERT conversion between DEC and HEX with valid input values -Checking DEC to HEX and HEX to DEC conversion of 18 digit random positive numbers for 15 seconds +Checking DEC to HEX and HEX to DEC conversion of 18 digit random positive numbers for 2 seconds Completed -Checking HEX to DEC and DEC to HEX conversion of 16 digit random values for 15 seconds +Checking HEX to DEC and DEC to HEX conversion of 16 digit random values for 2 seconds Completed diff --git a/v63009/inref/gtm9115.m b/v63009/inref/gtm9115.m new file mode 100644 index 000000000..01cef3b6b --- /dev/null +++ b/v63009/inref/gtm9115.m @@ -0,0 +1,636 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; ; +; Copyright (c) 2021 YottaDB LLC and/or its subsidiaries. ; +; All rights reserved. ; +; ; +; This source code contains the intellectual property ; +; of its copyright holder(s), and is made available ; +; under a license. If you do not know the terms of ; +; the license, please stop and do not read further. ; +; ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ; Test the correctness of the conversion by converting between DEC and OCT to + ; get back the original input. + ; DEC to OCT and OCT to DEC conversion is performed using random values of 18 digits as input. + ; OCT to DEC and DEC to OCT is performed using random values of 32 digits as input + ; Both types of conversion are executed for 2 seconds. + write "Checking DEC to OCT and OCT to DEC conversion of 18 digit random positive numbers for 2 seconds",! + set interval=2000000 ; 2 seconds in mili seconds + set iend=$zut+interval + set istart=1 + for do quit:iendOCT->DEC",maxvalue,! + write "Checking HEX to OCT and OCT to HEX conversion of maximum 64 bit value",! + set maxvalue="7FFFFFFFFFFFFFFF" + set HtoOrslt=$$FUNC^%HO(maxvalue) + set OtoHrslt=$$FUNC^%OH(HtoOrslt) + write:maxvalue'=OtoHrslt "FAILED to convert 64 bit maximum value from HEX->OCT->HEX",maxvalue,! + write "Checking DEC to OCT and OCT to DEC conversion of maximum 32 bit value",! + set maxvalue="4294967295" + set DtoOrslt=$$FUNC^%DO(maxvalue) + set OtoDrslt=$$FUNC^%OD(DtoOrslt) + write:maxvalue'=OtoDrslt "FAILED to convert 32 bit maximum value from DEC->OCT->DEC",maxvalue,! + write "Checking HEX to OCT and OCT to HEX conversion of maximum 64 bit value",! + set maxvalue="FFFFFFFF" + set HtoOrslt=$$FUNC^%HO(maxvalue) + set OtoHrslt=$$FUNC^%OH(HtoOrslt) + write:maxvalue'=OtoHrslt "FAILED to convert 32 bit maximum value from HEX->OCT->HEX",maxvalue,! + write "Completed",! + quit + +; The below routine checks that %HO rejects negative signed input and returns null. +horejectsignedinput + write "Checking if negative signed input to %HO is rejected and null is returned",! + set empty="" + set inpval="-FFFF" + set newhores=$$FUNC^%HO(inpval) + write:newhores'=empty "FAILED as conversion of an empty input returned a value ",newhores,! + write "Completed",! + quit + +; Correctness checking routines + +; The below routine checks that the current %DO implementation produces the same result as +; the pre-V6.3-009 implementation for up to a 16 digit input. +correctnessdectooct + write "Checking that the new implementation of %DO produces the same values as the previous implementation",! + set inpval=$$getrandnumdec(16) + set prevdores=$$FUNCPREVDECTOOCT(inpval,$length(inpval)) + set newdores=$$FUNC^%DO(inpval,$length(inpval)) + write:prevdores'=newdores "FAILED as conversion from dec to oct produced different values for pre-V6.3-009 and current implementations ",prevdores," ",newdores,! + write "Completed",! + quit + +; The below routine checks that the current %OD implementation produces the same result as +; the pre-V6.3-009 implementation for up to a 16 digit input. +correctnessocttodec + write "Checking that the new implementation of %OD produces the same values as the previous implementation",! + set inpval=$$getrandnumoct(16) + set prevodres=$$FUNCPREVOCTTODEC(inpval) + set newodres=$$FUNC^%OD(inpval) + write:prevodres'=newodres "FAILED as conversion from dec to oct produced different values for pre-V6.3-009 and current implementations ",prevodres," ",newodres,! + write "Completed",! + quit + +; The below routine checks that the current %HO implementation produces the same result as +; the pre-V6.3-009 implementation for up to a 16 digit input. +correctnesshextooct + write "Checking that the new implementation of %HO produces the same values as the previous implementation",! + set inpval=$$getrandnumhex(16) + set prevhores=$$FUNCPREVHEXTOOCT(inpval) + set newhores=$$FUNC^%HO(inpval) + write:prevhores'=newhores "FAILED as conversion from hex to oct resulted in different values for previous and new implementation ",prevhores," ",newhores,! + write "Completed",! + quit + +; The below routine checks that the current %OH implementation produces the same result as +; the pre-V6.3-009 implementation for up to a 16 digit input. +correctnessocttohex + write "Checking that the new implementation of %OH produces the same values as the previous implementation",! + set inpval=$$getrandnumoct(16) + set prevohres=$$FUNCPREVOCTTOHEX(inpval) + set newohres=$$FUNC^%OH(inpval) + write:prevohres'=newohres "FAILED as conversion from dec to oct produced different values for pre-V6.3-009 and current implementations ",prevohres," ",newohres,! + write "Completed",! + quit + +; Performance checking routines + +; The below routine checks the performance of the current %DO implementation with the pre-V6.3-009 implementation. +; Performance check is done for random input of exactly 16 digit and 20 digit length. Both implementations are run for a +; 2 second loop keeping track of the number of conversions done and this is compared to verify that the current implementation +; is faster. 16 digit and 20 digit inputs are used because they use different code paths in both versions of $DO. +compdectooct + write "Comparing performance of current %DO implementation vs previous %DO implementation for 16 digit values",! + set interval=2000000 + set iend=$zut+interval + set istart=1 + set ncnt=1 + for do quit:iend9 char=$char((i#10)+asciofa) ; ascii value of 'A' is added to the i#10 value resulting in characters 'A-F' + set inp=char + quit:n<2 inp + for j=1:1:n-1 do + . set i=$random(16),char=i + . set:i>9 char=$char((i#10)+asciofa) ; ascii value of 'A' is added to the i#10 value resulting in characters 'A-F' + . set inp=inp_char + quit inp + +; This generates a random hexadecimal number of length n where the first digit of +; the number is in the range 1-F and the remaining digits are in the range 0-F. +; This ensures that the number has no leading zeroes. +getrandnumhexexactlen(n) + set asciofa=$ascii("A") + set i=$random(15)+1,char=i + set:i>9 char=$char((i#10)+asciofa) ; ascii value of 'A' is added to the i#10 value resulting in characters 'A-F' + set inp=char + quit:n<2 inp + for j=1:1:n-1 do + . set i=$random(16),char=i + . set:i>9 char=$char((i#10)+asciofa) ; ascii value of 'A' is added to the i#10 value resulting in characters 'A-F' + . set inp=inp_char + quit inp + +; +; Pre V6.3-009 implementations of %HO, %DO, %OD and %OH +; plus pre V6.3-009 implemenation of convbaseutil are +; copied below for comparisons with current versions + +; pre-V6.3-009 %HO +FUNCPREVHEXTOOCTFM(h) + n c,d,dg,o + s d=0,h=$tr(h,"abcdef","ABCDEF"),o="" + f c=1:1:$l(h) s dg=$f("0123456789ABCDEF",$e(h,c)) q:'dg s d=(d*16)+(dg-2) + f q:'d s o=d#8_o,d=d\8 + q:0len1 len=len2 + for i=1:1:len do + . set tmp1=0,tmp2=0 + . set:(i'>len1) tmp1=c(($extract(val1r,i))) set:(i'>len2) tmp2=c(($extract(val2r,i))) + . set currsum=tmp1+tmp2+carry + . set res=d((currsum#base))_res,carry=$piece((currsum/base),".") + set:carry>0 res=carry_res + quit res +;Computes num*x by using x*((num>>2^0)&&1)*2^0 + ((num>>2^1)&&1)*2^1 + ((num>>2^2)&&1)*2^2 +...) +;Will multiply two arbitrary-length numbers for base <= 10, but for base > 10 will only multiply +;single digit numbers +PREVMULTIPLYBYNUMBER(num,x,base) + new res,k,c + if ($find("ABCDEF",num)) do + . for k=0:1:16 set:k<10 c($CHAR(k+48))=k SET:k'<10 c($CHAR(k+55))=k + . set num=c(num) + set res="0" + for quit:num=0 do + . if (num#2>0) do + .. set res=$$PREVADDVAL(res,x,base) + . set num=$piece((num/2),"."),x=$$PREVADDVAL(x,x,base) + quit res +PREVCONVERTBASE(val,frombase,tobase) + new m,res,power + set m=$$PREVVALIDLEN(val,frombase) + set res="0",power=1 + for quit:m<1 do + . set res=$$PREVADDVAL(res,$$PREVMULTIPLYBYNUMBER($extract(val,m),power,tobase),tobase) + . set power=$$PREVMULTIPLYBYNUMBER(frombase,power,tobase),m=$increment(m,-1) + quit res +;Takes a base 16 or base 8 number and converts that number +;into its two's compliment representation (flip bits and add one) +PREVCONVNEG(v,base) + new i,c,ns,charmap,pocharmap + set charmap="0123456789ABCDEF" + set:base=8 charmap="01234567" + set pocharmap=($extract(charmap,2,$length(charmap)))_"0" + set v=$translate(v,charmap,$reverse(charmap)) + set ns="",c="0" + for i=0:1:$length(v) quit:(c'="0") set c=$extract(v,$length(v)-i),c=$translate(c,charmap,pocharmap),ns=c_ns + set:i'=$length(v) ns=$extract(v,1,$length(v)-i)_ns + set:$find(($extract(charmap,1,(base/2))),$extract(ns,1)) ns=($extract(charmap,$length(charmap)))_ns + quit ns +;Returns length of string until which all characters are valid for the given base (works up to base 16) +PREVVALIDLEN(val,base) + new i,valbasechar,invalidi,len + set valbasechar=$extract("0123456789ABCDEF",1,base),len=$length(val) + quit:'len 0 + for i=1:1:$length(val) set invalidi='($find(valbasechar,($extract(val,i)))) quit:invalidi + quit $select($get(invalidi):i-1,1:i) diff --git a/v63009/instream.csh b/v63009/instream.csh index f6bc87382..937264ea2 100644 --- a/v63009/instream.csh +++ b/v63009/instream.csh @@ -26,6 +26,7 @@ # gtm9144 [kz] Test that loading a binary extract into a database with different null subscript collation type produces a DBDUPNULCOL error # gtm9134 [kz] Tests that when a replication Receiver Server waiting for a connection detects bad input, it resets the connection # gtm9123 [kz] Tests that GT.M produces a correct result with gtm_side_effect set to one or two +# gtm9115 [bdw] Tests %HO, %OH, %DO and %OD for correctness and for performance improvement compared to pre V6.3-009 versions #---------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -33,7 +34,7 @@ echo "v63009 test starts..." # List the subtests seperated by sspaces under the appropriate environment variable name setenv subtest_list_common "" -setenv subtest_list_non_replic "gtm9142 gtm8203 gtm9145 gtm8901 gtm8706 gtm9155 gtm9037 gtm9144 gtm9123" +setenv subtest_list_non_replic "gtm9142 gtm8203 gtm9145 gtm8901 gtm8706 gtm9155 gtm9037 gtm9144 gtm9123 gtm9115" setenv subtest_list_replic "gtm9037replic gtm9134" if ($?test_replic == 1) then diff --git a/v63009/outref/gtm9115.txt b/v63009/outref/gtm9115.txt new file mode 100644 index 000000000..dd3cd788f --- /dev/null +++ b/v63009/outref/gtm9115.txt @@ -0,0 +1,168 @@ + +Testing %DO, %OD, %HO and %OH conversion between DEC and OCT or HEX and OCT with valid input values +Checking DEC to OCT and OCT to DEC conversion of 18 digit random positive numbers for 2 seconds +Completed +Checking OCT to DEC and DEC to OCT conversion of 21 digit random values for 2 seconds +Completed +Checking HEX to OCT and OCT to HEX conversion of 16 digit random values for 2 seconds +Completed +Checking OCT to HEX and HEX to OCT conversion of 21 digit random values for 2 seconds +Completed + +Testing %DO, %OD, %HO and %OH conversion for 64 bit and 32 bit MAX values +Checking DEC to OCT and OCT to DEC conversion of maximum 64 bit value +Checking HEX to OCT and OCT to HEX conversion of maximum 64 bit value +Checking DEC to OCT and OCT to DEC conversion of maximum 32 bit value +Checking HEX to OCT and OCT to HEX conversion of maximum 64 bit value +Completed + +Testing HEX to OCT conversion of MAX input value +Input: FFFFFFFFFFFFFFFF +1777777777777777777777 + +Testing OCT to HEX conversion of MAX input value +Input: 1777777777777777777777 +FFFFFFFFFFFFFFFF + +Testing OCT to DEC conversion of MAX input value +Input: 1777777777777777777777 +18446744073709551615 + +Testing DEC to OCT conversion of MAX input value which is 20 digit MAX unsigned 64bit value +Input: 18446744073709551615 +1777777777777777777777 + +Testing DEC to OCT conversion of MAX negative 64bit input value +Input: -9223372036854775808 +7000000000000000000000 + +Testing ability of HEX to OCT conversion to handle case agnostic input with leading 0x +Input: 0xff +377 +Input: 0Xff +377 + +Testing ability of DEC to OCT conversion to ignore leading zeros for computation +Input: 000000000018446744073709551615 +1777777777777777777777 + +Testing ability of HEX to OCT conversion to ignore leading zeros for computation +Input: 0000000000FFFFFFFFFFFFFFFF +1777777777777777777777 + +Testing ability of OCT to DEC conversion to ignore leading zeros for computation +Input: 000000000001777777777777777777777 +18446744073709551615 + +Testing ability of OCT to HEX conversion to ignore leading zeros for computation +Input: 000000000001777777777777777777777 +FFFFFFFFFFFFFFFF + +Testing mixed valued input (part of YDB#685 portion of test) +Checking conversion for values such as 18446744073709551615vjj444, 177777777777777777777788 and FFFFFFFFFFFFFFFFhhh where only characters prior to the first occurence of an invalid character need to be considered +Checking conversion of positive decimal number 18446744073709551615vjj444 expecting 18446744073709551615 +Checking conversion of negative decimal value -9223372036854775807aaa expecting 7000000000000000000001 +Checking conversion of hexadecimal number FFFFFFFFFFFFFFFFhhh expecting FFFFFFFFFFFFFFFF +Completed + +Testing that invalid characters at end of input are handled correctly (YDB#685),! +%OD Input: 778 +63 +%OD Input: 77A +63 +%OH Input: 778 +3F +%OH Input: 77A +3F +%DO Input: 512k +000000001000 +%DH Input: 512k +00000200 +%HD Input: FFk +255 +%HO Input: FFk +377 + +Testing %HO for very large HEX input +Input: 7FFFFFFFFFFFFFFFFFFFFFFFFFFFF +177777777777777777777777777777777777777 + +Testing %DO for very large DEC input +Input: 18446744073709551616 +2000000000000000000000 + +Testing %DO for very large negative DEC input +Input: -9223372036854775809 +6777777777777777777777 + +Testing %OH for very large OCT input +Input: 77777777777777777777777777777777 +FFFFFFFFFFFFFFFFFFFFFFFF + +Testing %OD for very large OCT input +Input: 77777777777777777777777777777777 +79228162514264337593543950335 + +Testing %DO and %OD for signed input value +Checking conversion utilities %DO and %OD for signed value input +Completed + +Testing performance of current %DO vs previous %DO +Comparing performance of current %DO implementation vs previous %DO implementation for 16 digit values +##TEST_AWKPerformance: current [0-9]* previous [0-9]* +Comparing performance of current %DO implementation vs previous %DO implementation for 20 digit values +##TEST_AWKPerformance: current [0-9]* previous [0-9]* +Completed + +Testing Performance of current %OD vs previous %OD +Comparing performance of current %OD implementation vs previous %OD im plementation for 20 digit values +##TEST_AWKPerformance: current [0-9]* previous [0-9]* +Completed + +Testing Performance of current %HO vs previous %HO +Comparing performance of current %HO implementation vs previous %HO implementation for 14 digit values +##TEST_AWKPerformance: current [0-9]* previous [0-9]* +Comparing performance of current %HO implementation vs previous %HO implementation for 16 digit values +##TEST_AWKPerformance: current [0-9]* previous [0-9]* +Completed + +Testing Performance of current %OH vs previous %OH +Comparing performance of current %OH implementation vs previous %OH implementation for 16 digit values +##TEST_AWKPerformance: current [0-9]* previous [0-9]* +Comparing performance of current %OH implementation vs previous %OH implementation for 20 digit values +##TEST_AWKPerformance: current [0-9]* previous [0-9]* +Completed + +Testing correctness of current %DO vs previous %DO +Checking that the new implementation of %DO produces the same values as the previous implementation +Completed + +Testing correctness of current %OD vs previous %OD +Checking that the new implementation of %OD produces the same values as the previous implementation +Completed + +Testing correctness of current %HO vs previous %HO +Checking that the new implementation of %HO produces the same values as the previous implementation +Completed + +Testing correctness of current %OH vs previous %OH +Checking that the new implementation of %OH produces the same values as the previous implementation +Completed + +Testing that %HO rejects input starting with negative sign and returns null +Checking if negative signed input to %HO is rejected and null is returned +Completed + +Testing if default length of output for current %DO is still twelve digits like the pre-V6.3-009 implementation +Verifying default 12 byte output value length of %DO +Completed + +Testing invalid input expecting error as output from %DO, %OD, %OH and %HO +0000000000 +%YDB-E-LVUNDEF, Undefined local variable: o +0 +%YDB-E-LVUNDEF, Undefined local variable: h + +Testing null input on %HO, $OH, %OD and %DO +Checking the behavior of utility functions %HO, %OH, %OD and %DO when null input is given +Completed diff --git a/v63009/outref/outref.txt b/v63009/outref/outref.txt index 9f185e817..d8944a1f1 100644 --- a/v63009/outref/outref.txt +++ b/v63009/outref/outref.txt @@ -9,6 +9,7 @@ PASS from gtm9155 PASS from gtm9037 PASS from gtm9144 PASS from gtm9123 +PASS from gtm9115 ##ALLOW_OUTPUT REPLIC ##SUSPEND_OUTPUT NON_REPLIC PASS from gtm9037replic diff --git a/v63009/u_inref/gtm9115.csh b/v63009/u_inref/gtm9115.csh new file mode 100644 index 000000000..8e3ec30fb --- /dev/null +++ b/v63009/u_inref/gtm9115.csh @@ -0,0 +1,144 @@ +#!/usr/local/bin/tcsh -f +################################################################# +# # +# Copyright (c) 2021 YottaDB LLC and/or its subsidiaries. # +# All rights reserved. # +# # +# This source code contains the intellectual property # +# of its copyright holder(s), and is made available # +# under a license. If you do not know the terms of # +# the license, please stop and do not read further. # +# # +################################################################# +# + +echo '\nTesting %DO, %OD, %HO and %OH conversion between DEC and OCT or HEX and OCT with valid input values' +$ydb_dist/yottadb -r gtm9115 + +echo '\nTesting %DO, %OD, %HO and %OH conversion for 64 bit and 32 bit MAX values' +$ydb_dist/yottadb -r mxvalinp^gtm9115 + +echo '\nTesting HEX to OCT conversion of MAX input value' +echo "Input: FFFFFFFFFFFFFFFF" +$ydb_dist/yottadb -r ^%XCMD 'set %HO="FFFFFFFFFFFFFFFF" do ^%HO write %HO,!' + +echo '\nTesting OCT to HEX conversion of MAX input value' +echo "Input: 1777777777777777777777" +$ydb_dist/yottadb -r ^%XCMD 'set %OH="1777777777777777777777" do ^%OH write %OH,!' + +echo '\nTesting OCT to DEC conversion of MAX input value' +echo "Input: 1777777777777777777777" +$ydb_dist/yottadb -r ^%XCMD 'set %OD="1777777777777777777777" do ^%OD write %OD,!' + +echo '\nTesting DEC to OCT conversion of MAX input value which is 20 digit MAX unsigned 64bit value' +echo "Input: 18446744073709551615" +$ydb_dist/yottadb -r ^%XCMD 'set %DO="18446744073709551615" do ^%DO write %DO,!' + +echo '\nTesting DEC to OCT conversion of MAX negative 64bit input value' +echo "Input: -9223372036854775808" +$ydb_dist/yottadb -r ^%XCMD 'set %DO="-9223372036854775808" do ^%DO write %DO,!' + +echo '\nTesting ability of HEX to OCT conversion to handle case agnostic input with leading 0x' +echo "Input: 0xff" +$ydb_dist/yottadb -r ^%XCMD 'set %HO="0xff" do ^%HO write %HO,!' +echo "Input: 0Xff" +$ydb_dist/yottadb -r ^%XCMD 'set %HO="0Xff" do ^%HO write %HO,!' + +echo '\nTesting ability of DEC to OCT conversion to ignore leading zeros for computation' +echo "Input: 000000000018446744073709551615" +$ydb_dist/yottadb -r ^%XCMD 'set %DO="000000000018446744073709551615" do ^%DO write %DO,!' + +echo '\nTesting ability of HEX to OCT conversion to ignore leading zeros for computation' +echo "Input: 0000000000FFFFFFFFFFFFFFFF" +$ydb_dist/yottadb -r ^%XCMD 'set %HO="0000000000FFFFFFFFFFFFFFFF" do ^%HO write %HO,!' + +echo '\nTesting ability of OCT to DEC conversion to ignore leading zeros for computation' +echo "Input: 000000000001777777777777777777777" +$ydb_dist/yottadb -r ^%XCMD 'set %OD="000000000001777777777777777777777" do ^%OD write %OD,!' + +echo '\nTesting ability of OCT to HEX conversion to ignore leading zeros for computation' +echo "Input: 000000000001777777777777777777777" +$ydb_dist/yottadb -r ^%XCMD 'set %OH="000000000001777777777777777777777" do ^%OH write %OH,!' + +echo '\nTesting mixed valued input (part of YDB#685 portion of test)' +$ydb_dist/yottadb -r mixedvalinp^gtm9115 + +echo '\nTesting that invalid characters at end of input are handled correctly (YDB#685),!' +echo "%OD Input: 778" +$ydb_dist/yottadb -r ^%XCMD 'write $$FUNC^%OD(778),!' +echo "%OD Input: 77A" +$ydb_dist/yottadb -r ^%XCMD 'write $$FUNC^%OD("77A"),!' +echo "%OH Input: 778" +$ydb_dist/yottadb -r ^%XCMD 'write $$FUNC^%OH(778),!' +echo "%OH Input: 77A" +$ydb_dist/yottadb -r ^%XCMD 'write $$FUNC^%OH("77A"),!' +echo "%DO Input: 512k" +$ydb_dist/yottadb -r ^%XCMD 'write $$FUNC^%DO("512k"),!' +echo "%DH Input: 512k" +$ydb_dist/yottadb -r ^%XCMD 'write $$FUNC^%DH("512k"),!' +echo "%HD Input: FFk" +$ydb_dist/yottadb -r ^%XCMD 'write $$FUNC^%HD("FFk"),!' +echo "%HO Input: FFk" +$ydb_dist/yottadb -r ^%XCMD 'write $$FUNC^%HO("FFk"),!' + +echo '\nTesting %HO for very large HEX input' +echo "Input: 7FFFFFFFFFFFFFFFFFFFFFFFFFFFF" +$ydb_dist/yottadb -r ^%XCMD 'set %HO="7FFFFFFFFFFFFFFFFFFFFFFFFFFFF" do ^%HO write %HO,!' + +echo '\nTesting %DO for very large DEC input' +echo "Input: 18446744073709551616" +$ydb_dist/yottadb -r ^%XCMD 'set %DO="18446744073709551616" do ^%DO write %DO,!' + +echo '\nTesting %DO for very large negative DEC input' +echo "Input: -9223372036854775809" +$ydb_dist/yottadb -r ^%XCMD 'set %DO="-9223372036854775809" do ^%DO write %DO,!' + +echo '\nTesting %OH for very large OCT input' +echo "Input: 77777777777777777777777777777777" +$ydb_dist/yottadb -r ^%XCMD 'set %OH="77777777777777777777777777777777" do ^%OH write %OH,!' + +echo '\nTesting %OD for very large OCT input' +echo "Input: 77777777777777777777777777777777" +$ydb_dist/yottadb -r ^%XCMD 'set %OD="77777777777777777777777777777777" do ^%OD write %OD,!' + +echo '\nTesting %DO and %OD for signed input value' +$ydb_dist/yottadb -r signedvalinp^gtm9115 + +echo '\nTesting performance of current %DO vs previous %DO' +$ydb_dist/yottadb -r compdectooct^gtm9115 + +echo '\nTesting Performance of current %OD vs previous %OD' +$ydb_dist/yottadb -r compocttodec^gtm9115 + +echo '\nTesting Performance of current %HO vs previous %HO' +$ydb_dist/yottadb -r comphextooct^gtm9115 + +echo '\nTesting Performance of current %OH vs previous %OH' +$ydb_dist/yottadb -r compocttohex^gtm9115 + +echo '\nTesting correctness of current %DO vs previous %DO' +$ydb_dist/yottadb -r correctnessdectooct^gtm9115 + +echo '\nTesting correctness of current %OD vs previous %OD' +$ydb_dist/yottadb -r correctnessocttodec^gtm9115 + +echo '\nTesting correctness of current %HO vs previous %HO' +$ydb_dist/yottadb -r correctnesshextooct^gtm9115 + +echo '\nTesting correctness of current %OH vs previous %OH' +$ydb_dist/yottadb -r correctnessocttohex^gtm9115 + +echo '\nTesting that %HO rejects input starting with negative sign and returns null' +$ydb_dist/yottadb -r horejectsignedinput^gtm9115 + +echo '\nTesting if default length of output for current %DO is still twelve digits like the pre-V6.3-009 implementation' +$ydb_dist/yottadb -r defaultlenval^gtm9115 + +echo '\nTesting invalid input expecting error as output from %DO, %OD, %OH and %HO' +$ydb_dist/yottadb -r ^%XCMD 'write $$FUNC^%DO(,10)' +$ydb_dist/yottadb -r ^%XCMD 'write $$FUNC^%OD()' +$ydb_dist/yottadb -r ^%XCMD 'write $$FUNC^%OH()' +$ydb_dist/yottadb -r ^%XCMD 'write $$FUNC^%HO()' + +echo '\nTesting null input on %HO, $OH, %OD and %DO' +$ydb_dist/yottadb -r nullvalinp^gtm9115