My three oldest have all taken hard candy (like Jolly Ranchers or some peppermints) and water to the standardized tests w/o incident. They are usually done by around noon so risk of “crashing” from a sugar high seems pretty minimal. Any exhaustion would be later in the day once the adrenaline wears off.
I don’t think you are allowed to eat during the test but during the breaks it should be ok. It should be something reasonably non-messy and easy to unwrap. You don’t want to have to excuse yourself to go wash your hands right before the test resumes! When I was a student we were told “candy corn, life savers, butterscotch disks etc. are fine” (ok this was the olden days, folks!).
Definitely use the practice tests to figure out what can work for you. Have your “fueling strategy” nailed down by test day, just like you would if you were planning to run a long race that day