In most cases, the LEGO EV3 program does exactly what you have programmed it to do. If you are having trouble, follow these troubleshooting steps:
1. Look over your program block by block and review your process map to make sure they match.
2. If there isn't anything obviously wrong with your program, it is often helpful to start with a simple version of your program. Test the simple version, and then add complexity step by step, testing the program with each addition.
A technique that we use to test programs is to add a Sound block (make different sounds for true and false cases of a switch) or a Display block (to show sensor readings). These blocks can help you troubleshoot by adding feedback that will help you see how the program is functioning.
LEGO® MINDSTORMS® Education EV3 Core Set with Charger, order code LEGO-EV3-CORE, $412
NXT Sensor Adapter, order code BTA-NXT, $39
Vernier Engineering Projects with LEGO® MINDSTORMS® Education EV3 (Electronic Version), order code EP-EV3-E, $40
TIL 3339: LEGO® Mindstorms® EV3 Troubleshooting and FAQs