This sequence (globals) fails on that 1st line on an EDGE 530 and EDGE 1030 (simulator and on real devices), but works fine on an EDGE 1040 and EDGE 1050 (simulator and real devices).
Moving the testval assignment under the enum and array works on all devices.
I get it - I guess. I've never seen ordering cause an issue before - but maybe I just never did this before. On newer devices it doesn't matter.