wlandsman / IDLAstro

Astronomy related procedures in the commercial IDL language
https://asd.gsfc.nasa.gov/archive/idlastro/
BSD 2-Clause "Simplified" License
144 stars 64 forks source link

Compare struct procedure cannot cope with structures having hashes as members #23

Closed rcolomina closed 6 years ago

rcolomina commented 7 years ago

Procedure compare_struct.pro cannot does not work if any member of the target structures has as member a hash.

TEST PROCEDURE

print," " print, "Test Case : Comparing structures with hashes on it" s1 = {x:1,h1:hash("x",1,"y",2)} s2 = {x:1,h1:hash("x",1,"y",2)} print,"s1:",s1 print,"s2:",s2 compare_struct(s1,s21)

OUTPUT

% Compiled module: COMPARE_STRUCT. { "TAG_NUM_A": 1, "TAG_NUM_B": 1, "FIELD": ".H1", "NDIFF": 1 }

wlandsman commented 6 years ago

I committed a fix today which uses the fact that if s1 and s2 are identical hashes then s1 NE s2 returns an empty list. Not well tested