| 267 | } |
| 268 | |
| 269 | void loop() { |
| 270 | // Server updates are now handled by the task (every 1ms) |
| 271 | // No need for manual server.update() here |
| 272 | |
| 273 | // Wait 1 second after startup before starting tests |
| 274 | if (state == SERVER_STARTING && (fl::millis() - test_start_time > 1000)) { |
| 275 | FL_WARN("================================="); |
| 276 | FL_WARN("Starting HTTP Client Tests"); |
| 277 | FL_WARN("================================="); |
| 278 | state = TEST_JSON; |
| 279 | } |
| 280 | |
| 281 | // Run tests sequentially |
| 282 | if (state == TEST_JSON) { |
| 283 | test_json_endpoint(); |
| 284 | if (state != FAILED) state = TEST_GET; |
| 285 | delay(500); |
| 286 | } |
| 287 | else if (state == TEST_GET) { |
| 288 | test_get_endpoint(); |
| 289 | if (state != FAILED) state = TEST_PING; |
| 290 | delay(500); |
| 291 | } |
| 292 | else if (state == TEST_PING) { |
| 293 | test_ping_endpoint(); |
| 294 | if (state != FAILED) { |
| 295 | // All tests passed! |
| 296 | state = ALL_PASSED; |
| 297 | |
| 298 | FL_WARN("\n================================="); |
| 299 | FL_WARN("Test Results"); |
| 300 | FL_WARN("================================="); |
| 301 | FL_WARN("Passed: " << tests_passed); |
| 302 | FL_WARN("Failed: " << tests_failed); |
| 303 | FL_WARN("Total: " << (tests_passed + tests_failed)); |
| 304 | FL_WARN("================================="); |
| 305 | FL_WARN("✓ All tests PASSED"); |
| 306 | } |
| 307 | delay(500); |
| 308 | } |
| 309 | else if (state == FAILED && !done) { |
| 310 | FL_WARN("\n================================="); |
| 311 | FL_WARN("Test Results"); |
| 312 | FL_WARN("================================="); |
| 313 | FL_WARN("Passed: " << tests_passed); |
| 314 | FL_WARN("Failed: " << tests_failed); |
| 315 | FL_WARN("Total: " << (tests_passed + tests_failed)); |
| 316 | FL_WARN("================================="); |
| 317 | FL_WARN("✗ Some tests FAILED"); |
| 318 | done = true; |
| 319 | // Signal completion - cleanup happens automatically via ScopedEngineCleanup |
| 320 | #ifdef FASTLED_STUB |
| 321 | fl::stub_main::stop_loop(); |
| 322 | #endif |
| 323 | } |
| 324 | else if (state == ALL_PASSED && !done) { |
| 325 | done = true; |
| 326 | // Signal completion - cleanup happens automatically via ScopedEngineCleanup |
nothing calls this directly
no test coverage detected