2019-06-19 20:26:38 +00:00
|
|
|
#include "tests.h"
|
|
|
|
#include "effects.h"
|
|
|
|
|
|
|
|
namespace tests {
|
|
|
|
void run() {
|
|
|
|
LOGln("Tests * Running test for memory leaks...");
|
|
|
|
test_effects_for_memory_leaks();
|
|
|
|
}
|
2019-09-04 04:07:28 +00:00
|
|
|
|
2019-06-19 20:26:38 +00:00
|
|
|
void test_effects_for_memory_leaks() {
|
|
|
|
int i=0;
|
|
|
|
Effect* effect;
|
|
|
|
int32_t diffs[3] = {0, 0, 0};
|
|
|
|
while (1) {
|
|
|
|
for (int j=0; j<3; j++) {
|
|
|
|
int free_at_start = ESP.getFreeHeap();
|
|
|
|
effect = select_effect(i);
|
|
|
|
if (effect == NULL) return;
|
|
|
|
delete effect;
|
2019-09-04 04:07:28 +00:00
|
|
|
diffs[i] = ESP.getFreeHeap() - free_at_start;
|
2019-06-19 20:26:38 +00:00
|
|
|
}
|
2019-09-04 04:07:28 +00:00
|
|
|
LOGln("Tests * Memory leakage of effect #%d: %d, %d, %d", i, diffs[0], diffs[1], diffs[2]);
|
2019-06-19 20:26:38 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|