Beispiel #1
0
LONGBOW_TEST_CASE(Object, parcStopwatch_HashCode)
{
    PARCStopwatch *x = parcStopwatch_Create();
    PARCStopwatch *y = parcStopwatch_Create();

    parcObjectTesting_AssertHashCode(x, y);

    parcStopwatch_Release(&x);
    parcStopwatch_Release(&y);
}
Beispiel #2
0
LONGBOW_TEST_CASE(Object, parcStopwatch_Equals)
{
    PARCStopwatch *x = parcStopwatch_Create();
    PARCStopwatch *y = parcStopwatch_Create();
    PARCStopwatch *z = parcStopwatch_Create();

    parcObjectTesting_AssertEquals(x, y, z, NULL);

    parcStopwatch_Release(&x);
    parcStopwatch_Release(&y);
    parcStopwatch_Release(&z);
}
Beispiel #3
0
LONGBOW_TEST_CASE(Object, parcStopwatch_IsValid)
{
    PARCStopwatch *instance = parcStopwatch_Create();
    assertTrue(parcStopwatch_IsValid(instance), "Expected parcStopwatch_Create to result in a valid instance.");

    parcStopwatch_Release(&instance);
    assertFalse(parcStopwatch_IsValid(instance), "Expected parcStopwatch_Release to result in an invalid instance.");
}
Beispiel #4
0
PARCStopwatch *
parcStopwatch_Copy(const PARCStopwatch *original)
{
    PARCStopwatch *result = parcStopwatch_Create();
    result->start = original->start;
    result->stop = original->stop;

    return result;
}
Beispiel #5
0
LONGBOW_TEST_CASE(Specialization, parcStopwatch_Multi)
{
    PARCStopwatch *a = parcStopwatch_Create();
    PARCStopwatch *b = parcStopwatch_Create();
    PARCStopwatch *c = parcStopwatch_Create();
   
    parcStopwatch_Start(a, b, c);
    sleep(2);
    uint64_t nanos = parcStopwatch_ElapsedTimeNanos(a);
    printf("%llu %llu\n", nanos, nanos/1000000000);
    if (nanos > (3000000000)) {
        parcStopwatch_Display(a, 0);
    }
   
    parcStopwatch_Release(&a);
    parcStopwatch_Release(&b);
    parcStopwatch_Release(&c);
}
Beispiel #6
0
LONGBOW_TEST_CASE(Object, parcStopwatch_Copy)
{
    PARCStopwatch *instance = parcStopwatch_Create();
    PARCStopwatch *copy = parcStopwatch_Copy(instance);
    assertTrue(parcStopwatch_Equals(instance, copy), "Expected the copy to be equal to the original");

    parcStopwatch_Release(&instance);
    parcStopwatch_Release(&copy);
}
Beispiel #7
0
LONGBOW_TEST_CASE(Object, parcStopwatch_ToJSON)
{
    PARCStopwatch *instance = parcStopwatch_Create();

    PARCJSON *json = parcStopwatch_ToJSON(instance);

    parcJSON_Release(&json);

    parcStopwatch_Release(&instance);
}
Beispiel #8
0
LONGBOW_TEST_CASE(CreateAcquireRelease, CreateRelease)
{
    PARCStopwatch *instance = parcStopwatch_Create();
    assertNotNull(instance, "Expected non-null result from parcStopwatch_Create();");

    parcObjectTesting_AssertAcquireReleaseContract(parcStopwatch_Acquire, instance);

    parcStopwatch_Release(&instance);
    assertNull(instance, "Expected null result from parcStopwatch_Release();");
}
Beispiel #9
0
LONGBOW_TEST_CASE(Object, parcStopwatch_ToString)
{
    PARCStopwatch *instance = parcStopwatch_Create();

    char *string = parcStopwatch_ToString(instance);

    assertNotNull(string, "Expected non-NULL result from parcStopwatch_ToString");

    parcMemory_Deallocate((void **) &string);
    parcStopwatch_Release(&instance);
}
Beispiel #10
0
LONGBOW_TEST_CASE(Specialization, parcStopwatch_ElapsedTimeNanos)
{
    PARCStopwatch *instance = parcStopwatch_Create();

    parcStopwatch_StartImpl(instance, NULL);
    sleep(2);
    uint64_t nanos = parcStopwatch_ElapsedTimeNanos(instance);
    printf("%llu %llu\n", nanos, nanos/1000000000);
    if (nanos > (3000000000)) {
        parcStopwatch_Display(instance, 0);
    }
   
    parcStopwatch_Release(&instance);
}
Beispiel #11
0
LONGBOW_TEST_CASE(Object, parcStopwatch_Display)
{
    PARCStopwatch *instance = parcStopwatch_Create();
    parcStopwatch_Display(instance, 0);
    parcStopwatch_Release(&instance);
}