Talk:CRC-32: Difference between revisions

Content added Content deleted
(→‎REXX: Regina seems to be 'wrong' here!)
(→‎REXX: Extended the test program to show how it works and commented on the questions)
Line 81: Line 81:
* 18.08.2013 Walter Pachl Test c2d behavior
* 18.08.2013 Walter Pachl Test c2d behavior
**********************************************************************/
**********************************************************************/
Parse Version v
Say v
cnt.=0
cnt.=0
c=d2c(999999999)
c=d2c(999999999)
id='001'
If c2x(c)='3B9AC9FF' Then cnt.0ok=cnt.0ok+1
If c2x(c)='3B9AC9FF' Then
Call cnt 'ok'
d=c2d(c)
d=c2d(c)
Signal on Syntax
Signal on Syntax
id='S001'
d1=d2c(d+1)
d1=d2c(d+1)
cnt.0err=cnt.0err+1
cnt.0err=cnt.0err+1
BS001:
back:
Signal on Syntax
id='002'
rec=c2d('ffffffff'x)
B002:
id='003'
Numeric Digits 10
say c2d('ffffffff'x)
B003:
id='004'
Numeric Digits 20
say c2d('ffffffffffff'x)
B004:
Say cnt.0ok 'Tests ok'
Say cnt.0ok 'Tests ok'
Say cnt.0err 'Tests failed'
Say cnt.0err 'Tests failed'
Exit
Exit

cnt:
Parse Arg x
If x='ok' Then
cnt.0ok=cnt.0ok+1
Else Do
cnt.0err=cnt.0err+1
Say 'Test' id 'failed'
End
Return

syntax:
syntax:
If left(id,1)='S' Then
cnt.0ok=cnt.0ok+1
Call cnt 'ok'
Signal back</lang>
Else
Call cnt id
Signal value('B'id)</lang>
--[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 05:53, 18 August 2013 (UTC)
--[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 05:53, 18 August 2013 (UTC)


Line 101: Line 132:
I don't quite understand the reasoning/logic behind the test program:
I don't quite understand the reasoning/logic behind the test program:
: if the program gets a SYNTAX error ''anywhere'', it counts as OK.
: if the program gets a SYNTAX error ''anywhere'', it counts as OK.
:: not anymore
: if the program successfully does the two '''D2C'''s, it counts as an error in one case, but not the other.
: if the program successfully does the two '''D2C'''s, it counts as an error in one case, but not the other.
: if the program successfully does the 2nd '''D2C''', it is counted as an error.
: if the program successfully does the 2nd '''D2C''', it is counted as an error.
:: that's because it should not do it successfully
: no check is made to verify that the value of '''D''' matches the value of the 1st argument (999999999).
: no check is made to verify that the value of '''D''' matches the value of the 1st argument (999999999).
:: the result is compared with the value that should be there
A &nbsp; &nbsp; '''parse version x; say x''' &nbsp; &nbsp; was added after the 1st statement.
A &nbsp; &nbsp; '''parse version x; say x''' &nbsp; &nbsp; was added after the 1st statement.
<br>A &nbsp; &nbsp; '''say 'digits=' digits()''' &nbsp; &nbsp; would be a nice addition.
<br>A &nbsp; &nbsp; '''say 'digits=' digits()''' &nbsp; &nbsp; would be a nice addition.