Пример #1
0
int main(int argc, char *argv[])
{
    char *pgm = argv[0];
    int rc, test_rc;
    
    if (argc < 2) {
        fprintf(stderr, "%s: at least one option must be specified\n",
                argv[0]);
        exit (1);
    }

    test_rc = strtol(argv[1], NULL, 0);

    printf("%s| starting...\n", pgm);

    printf("%s| tx_open(): %d\n", pgm, rc = tx_open());
    assert(TX_OK == rc);

    printf("%s| tx_begin(): %d\n", pgm, rc = tx_begin());
    assert(test_rc == rc);

    if (TX_OK == test_rc) {
        printf("%s| tx_rollback(): %d\n", pgm, rc = tx_rollback());
        assert(TX_OK == rc);
    }

    printf("%s| tx_close(): %d\n", pgm, rc = tx_close());
    if (TX_FAIL == test_rc)
        assert(TX_FAIL == test_rc);
    else
        assert(TX_OK == rc);

    /* memory leak prevention */
    lixa_tx_close_cleanup();
    lixa_monkeyrm_call_cleanup();
    
    printf("%s| ...finished\n", pgm);
    return 0;
}
Пример #2
0
int main(int argc, char *argv[])
{
    char *pgm = argv[0];
    int rc, test_rc, xaopen;
    
    if (argc < 3) {
        fprintf(stderr, "%s: at least two options must be specified\n",
                argv[0]);
        exit (1);
    }

    xaopen = strtol(argv[1], NULL, 0);
    test_rc = strtol(argv[2], NULL, 0);

    printf("%s| starting...\n", pgm);

    printf("%s| tx_open(): %d\n", pgm, rc = tx_open());
    if (xaopen)
        assert(test_rc == rc);
    else
        assert(TX_OK == rc);

    if (xaopen && TX_OK == test_rc) {
        printf("%s| tx_close(): %d\n", pgm, rc = tx_close());
        assert(TX_OK == rc);
    } else if (!xaopen) {
        printf("%s| tx_close(): %d\n", pgm, rc = tx_close());
        assert(test_rc == rc);
    }
    
    /* memory leak prevention */
    lixa_tx_close_cleanup();
    lixa_monkeyrm_call_cleanup();

    printf("%s| ...finished\n", pgm);
    return 0;
}
Пример #3
0
int main(int argc, char *argv[])
{
    char *pgm = argv[0];
    int rc, commit, test_rc;
    
    if (argc < 3) {
        fprintf(stderr, "%s: at least two options must be specified\n",
                argv[0]);
        exit (1);
    }
    commit = strtol(argv[1], NULL, 0);
    test_rc = strtol(argv[2], NULL, 0);

    printf("%s| starting...\n", pgm);

    printf("%s| tx_open(): %d\n", pgm, rc = tx_open());
    assert(TX_OK == rc);

    printf("%s| tx_begin(): %d\n", pgm, rc = tx_begin());
    assert(TX_OK == rc);

    if (commit)
        printf("%s| tx_commit(): %d\n", pgm, rc = tx_commit());
    else
        printf("%s| tx_rollback(): %d\n", pgm, rc = tx_rollback());        
    assert(test_rc == rc);

    printf("%s| tx_close(): %d\n", pgm, rc = tx_close());
    if (TX_FAIL == test_rc) {
        assert(TX_FAIL == rc);
        lixa_tx_close_cleanup();
    } else
        assert(TX_OK == rc);

    printf("%s| ...finished\n", pgm);
    return 0;
}