#include <stdio.h>
#include <string.h>
#include <pslib.h>
#include <psmodules.h>
#include "tap.h"
#include "pstap.h"

int main(int argc, char* argv[])
{
    psLogSetFormat("HLNM");
    psLogSetLevel(PS_LOG_INFO);
    plan_tests(11);

    // Test pmMomentsAlloc()
    {
        psMemId id = psMemGetId();
        pmMoments *tmpMoments = pmMomentsAlloc();
        ok(tmpMoments != NULL, "pmMomentsAlloc() returned a non-NULL pmMoments");
        skip_start(tmpMoments == NULL, 9, "Skipping tests because pmMomentsAlloc() returned NULL");
        ok(tmpMoments->x == 0.0, "pmMomentsAlloc set->x correctly");
        ok(tmpMoments->y == 0.0, "pmMomentsAlloc set->y correctly");
        ok(tmpMoments->Sx == 0.0, "pmMomentsAlloc set->Sx correctly");
        ok(tmpMoments->Sy == 0.0, "pmMomentsAlloc set->Sy correctly");
        ok(tmpMoments->Sxy == 0.0, "pmMomentsAlloc set->Sxy correctly");
        ok(tmpMoments->Sum == 0.0, "pmMomentsAlloc set->Sum correctly");
        ok(tmpMoments->Peak == 0.0, "pmMomentsAlloc set->Peak correctly");
        ok(tmpMoments->Sky == 0.0, "pmMomentsAlloc set->Sky correctly");
        ok(tmpMoments->nPixels == 0, "pmMomentsAlloc set->nPixels correctly");
        psFree(tmpMoments);
        skip_end();
        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    }
}
