All unit tests should be (1) intentionally designed for coverage, (2) non-redundant, and (3) maintainable.
Apply these rules:
1) Enforce correctness with invariants
int cpucount = ncnn::get_cpu_count();
int bigcpucount = ncnn::get_big_cpu_count();
int littlecpucount = ncnn::get_little_cpu_count();
if (bigcpucount + littlecpucount != cpucount || bigcpucount > cpucount || !(littlecpucount < cpucount))
return -1;
2) Cover critical tensor ranks/shapes, not just “typical” ones
3) Reuse shared test helpers for layer/model execution
test_layer<>-style utility) instead of duplicating manual layer creation, parameter loading, pipeline creation, and forward logic.4) Remove duplicated or near-identical test cases
Result: tests become smaller, faster to review, easier to maintain, and less likely to miss regressions due to missing shape variants or redundant cases.
Enter the URL of a public GitHub repository