Changeset 4b54bd9 in mainline for uspace/lib/pcut/tests


Ignore:
Timestamp:
2018-09-12T13:23:03Z (7 years ago)
Author:
Vojtech Horky <vojtech.horky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3da0ee4
Parents:
275530a4
Message:

Update PCUT to latest revision

Location:
uspace/lib/pcut/tests
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/pcut/tests/abort.c

    r275530a4 r4b54bd9  
    3030#include <stdlib.h>
    3131
    32 PCUT_INIT;
     32PCUT_INIT
    3333
    34 PCUT_TEST(access_null_pointer)
    35 {
     34PCUT_TEST(access_null_pointer) {
    3635        abort();
    3736}
    3837
    39 PCUT_MAIN();
     38PCUT_MAIN()
  • uspace/lib/pcut/tests/asserts.c

    r275530a4 r4b54bd9  
    3030#include "tested.h"
    3131
    32 PCUT_INIT;
     32PCUT_INIT
    3333
    34 PCUT_TEST(int_equals)
    35 {
     34PCUT_TEST(int_equals) {
    3635        PCUT_ASSERT_INT_EQUALS(1, 1);
    3736        PCUT_ASSERT_INT_EQUALS(1, 0);
    3837}
    3938
    40 PCUT_TEST(double_equals)
    41 {
     39PCUT_TEST(double_equals) {
    4240        PCUT_ASSERT_DOUBLE_EQUALS(1., 1., 0.001);
    4341        PCUT_ASSERT_DOUBLE_EQUALS(1., 0.5, 0.4);
    4442}
    4543
    46 PCUT_TEST(str_equals)
    47 {
     44PCUT_TEST(str_equals) {
    4845        PCUT_ASSERT_STR_EQUALS("xyz", "xyz");
    4946        PCUT_ASSERT_STR_EQUALS("abc", "xyz");
    5047}
    5148
    52 PCUT_TEST(str_equals_or_null_base)
    53 {
     49PCUT_TEST(str_equals_or_null_base) {
    5450        PCUT_ASSERT_STR_EQUALS_OR_NULL("xyz", "xyz");
    5551}
    5652
    57 PCUT_TEST(str_equals_or_null_different)
    58 {
     53PCUT_TEST(str_equals_or_null_different) {
    5954        PCUT_ASSERT_STR_EQUALS_OR_NULL("abc", "xyz");
    6055}
    6156
    62 PCUT_TEST(str_equals_or_null_one_null)
    63 {
     57PCUT_TEST(str_equals_or_null_one_null) {
    6458        PCUT_ASSERT_STR_EQUALS_OR_NULL(NULL, "xyz");
    6559}
    6660
    67 PCUT_TEST(str_equals_or_null_both)
    68 {
     61PCUT_TEST(str_equals_or_null_both) {
    6962        PCUT_ASSERT_STR_EQUALS_OR_NULL(NULL, NULL);
    7063}
    7164
    72 PCUT_TEST(assert_true)
    73 {
     65PCUT_TEST(assert_true) {
    7466        PCUT_ASSERT_TRUE(42);
    7567        PCUT_ASSERT_TRUE(0);
    7668}
    7769
    78 PCUT_TEST(assert_false)
    79 {
     70PCUT_TEST(assert_false) {
    8071        PCUT_ASSERT_FALSE(0);
    8172        PCUT_ASSERT_FALSE(42);
    8273}
    8374
    84 PCUT_MAIN();
     75PCUT_MAIN()
  • uspace/lib/pcut/tests/beforeafter.c

    r275530a4 r4b54bd9  
    3434#include <stdio.h>
    3535
    36 /*
    37  * Use sprintf_s in Windows but only with Microsoft compiler.
    38  * Namely, let MinGW use snprintf.
    39  */
    40 #if (defined(__WIN64) || defined(__WIN32) || defined(_WIN32)) && defined(_MSC_VER)
    41 #define snprintf sprintf_s
    42 #endif
    43 
    44 PCUT_INIT;
     36PCUT_INIT
    4537
    4638static char *buffer = NULL;
     
    4941PCUT_TEST_SUITE(suite_with_setup_and_teardown);
    5042
    51 PCUT_TEST_BEFORE
    52 {
     43PCUT_TEST_BEFORE {
    5344        buffer = malloc(BUFFER_SIZE);
    5445        PCUT_ASSERT_NOT_NULL(buffer);
    5546}
    5647
    57 PCUT_TEST_AFTER
    58 {
     48PCUT_TEST_AFTER {
    5949        free(buffer);
    6050        buffer = NULL;
    6151}
    6252
    63 PCUT_TEST(test_with_setup_and_teardown)
    64 {
     53PCUT_TEST(test_with_setup_and_teardown) {
     54#if (defined(__WIN64) || defined(__WIN32) || defined(_WIN32)) && defined(_MSC_VER)
     55        _snprintf_s(buffer, BUFFER_SIZE - 1, _TRUNCATE, "%d-%s", 56, "abcd");
     56#else
    6557        snprintf(buffer, BUFFER_SIZE - 1, "%d-%s", 56, "abcd");
     58#endif
     59
    6660        PCUT_ASSERT_STR_EQUALS("56-abcd", buffer);
    6761}
     
    6963PCUT_TEST_SUITE(another_without_setup);
    7064
    71 PCUT_TEST(test_without_any_setup_or_teardown)
    72 {
     65PCUT_TEST(test_without_any_setup_or_teardown) {
    7366        PCUT_ASSERT_NULL(buffer);
    7467}
    7568
    7669
    77 PCUT_MAIN();
     70PCUT_MAIN()
  • uspace/lib/pcut/tests/errno.c

    r275530a4 r4b54bd9  
    3535#endif
    3636
    37 PCUT_INIT;
     37PCUT_INIT
    3838
    39 PCUT_TEST(errno_value)
    40 {
    41         errno_t value = EOK;
     39PCUT_TEST(errno_value) {
     40        int value = EOK;
    4241        PCUT_ASSERT_ERRNO_VAL(EOK, value);
    4342        value = ENOENT;
     
    4847}
    4948
    50 PCUT_TEST(errno_variable)
    51 {
     49PCUT_TEST(errno_variable) {
    5250        errno = ENOENT;
    5351        PCUT_ASSERT_ERRNO(ENOENT);
     
    5755}
    5856
    59 PCUT_MAIN();
     57PCUT_MAIN()
  • uspace/lib/pcut/tests/inithook.c

    r275530a4 r4b54bd9  
    3030#include "tested.h"
    3131
    32 PCUT_INIT;
     32PCUT_INIT
    3333
    3434static int init_counter = 0;
    3535
    36 static void init_hook(void)
    37 {
     36static void init_hook(void) {
    3837        init_counter++;
    3938}
    4039
    41 PCUT_TEST_BEFORE
    42 {
     40PCUT_TEST_BEFORE {
    4341        PCUT_ASSERT_INT_EQUALS(1, init_counter);
    4442        init_counter++;
    4543}
    4644
    47 PCUT_TEST(check_init_counter)
    48 {
     45PCUT_TEST(check_init_counter) {
    4946        PCUT_ASSERT_INT_EQUALS(2, init_counter);
    5047}
    5148
    52 PCUT_TEST(check_init_counter_2)
    53 {
     49PCUT_TEST(check_init_counter_2) {
    5450        PCUT_ASSERT_INT_EQUALS(2, init_counter);
    5551}
    5652
    5753
    58 PCUT_CUSTOM_MAIN(PCUT_MAIN_SET_INIT_HOOK(init_hook));
     54PCUT_CUSTOM_MAIN(
     55        PCUT_MAIN_SET_INIT_HOOK(init_hook)
     56)
    5957
  • uspace/lib/pcut/tests/manytests.c

    r275530a4 r4b54bd9  
    3434 */
    3535
    36 PCUT_INIT;
     36PCUT_INIT
    3737
    38 PCUT_TEST(my_test_001)
    39 {
    40 }
    41 PCUT_TEST(my_test_002)
    42 {
    43 }
    44 PCUT_TEST(my_test_003)
    45 {
    46 }
    47 PCUT_TEST(my_test_004)
    48 {
    49 }
    50 PCUT_TEST(my_test_005)
    51 {
    52 }
    53 PCUT_TEST(my_test_006)
    54 {
    55 }
    56 PCUT_TEST(my_test_007)
    57 {
    58 }
    59 PCUT_TEST(my_test_008)
    60 {
    61 }
    62 PCUT_TEST(my_test_009)
    63 {
    64 }
    65 PCUT_TEST(my_test_010)
    66 {
    67 }
    68 PCUT_TEST(my_test_011)
    69 {
    70 }
    71 PCUT_TEST(my_test_012)
    72 {
    73 }
    74 PCUT_TEST(my_test_013)
    75 {
    76 }
    77 PCUT_TEST(my_test_014)
    78 {
    79 }
    80 PCUT_TEST(my_test_015)
    81 {
    82 }
    83 PCUT_TEST(my_test_016)
    84 {
    85 }
    86 PCUT_TEST(my_test_017)
    87 {
    88 }
    89 PCUT_TEST(my_test_018)
    90 {
    91 }
    92 PCUT_TEST(my_test_019)
    93 {
    94 }
    95 PCUT_TEST(my_test_020)
    96 {
    97 }
    98 PCUT_TEST(my_test_021)
    99 {
    100 }
    101 PCUT_TEST(my_test_022)
    102 {
    103 }
    104 PCUT_TEST(my_test_023)
    105 {
    106 }
    107 PCUT_TEST(my_test_024)
    108 {
    109 }
    110 PCUT_TEST(my_test_025)
    111 {
    112 }
    113 PCUT_TEST(my_test_026)
    114 {
    115 }
    116 PCUT_TEST(my_test_027)
    117 {
    118 }
    119 PCUT_TEST(my_test_028)
    120 {
    121 }
    122 PCUT_TEST(my_test_029)
    123 {
    124 }
    125 PCUT_TEST(my_test_030)
    126 {
    127 }
    128 PCUT_TEST(my_test_031)
    129 {
    130 }
    131 PCUT_TEST(my_test_032)
    132 {
    133 }
    134 PCUT_TEST(my_test_033)
    135 {
    136 }
    137 PCUT_TEST(my_test_034)
    138 {
    139 }
    140 PCUT_TEST(my_test_035)
    141 {
    142 }
    143 PCUT_TEST(my_test_036)
    144 {
    145 }
    146 PCUT_TEST(my_test_037)
    147 {
    148 }
    149 PCUT_TEST(my_test_038)
    150 {
    151 }
    152 PCUT_TEST(my_test_039)
    153 {
    154 }
    155 PCUT_TEST(my_test_040)
    156 {
    157 }
    158 PCUT_TEST(my_test_041)
    159 {
    160 }
    161 PCUT_TEST(my_test_042)
    162 {
    163 }
    164 PCUT_TEST(my_test_043)
    165 {
    166 }
    167 PCUT_TEST(my_test_044)
    168 {
    169 }
    170 PCUT_TEST(my_test_045)
    171 {
    172 }
    173 PCUT_TEST(my_test_046)
    174 {
    175 }
    176 PCUT_TEST(my_test_047)
    177 {
    178 }
    179 PCUT_TEST(my_test_048)
    180 {
    181 }
    182 PCUT_TEST(my_test_049)
    183 {
    184 }
    185 PCUT_TEST(my_test_050)
    186 {
    187 }
    188 PCUT_TEST(my_test_051)
    189 {
    190 }
    191 PCUT_TEST(my_test_052)
    192 {
    193 }
    194 PCUT_TEST(my_test_053)
    195 {
    196 }
    197 PCUT_TEST(my_test_054)
    198 {
    199 }
    200 PCUT_TEST(my_test_055)
    201 {
    202 }
    203 PCUT_TEST(my_test_056)
    204 {
    205 }
    206 PCUT_TEST(my_test_057)
    207 {
    208 }
    209 PCUT_TEST(my_test_058)
    210 {
    211 }
    212 PCUT_TEST(my_test_059)
    213 {
    214 }
    215 PCUT_TEST(my_test_060)
    216 {
    217 }
    218 PCUT_TEST(my_test_061)
    219 {
    220 }
    221 PCUT_TEST(my_test_062)
    222 {
    223 }
    224 PCUT_TEST(my_test_063)
    225 {
    226 }
    227 PCUT_TEST(my_test_064)
    228 {
    229 }
    230 PCUT_TEST(my_test_065)
    231 {
    232 }
    233 PCUT_TEST(my_test_066)
    234 {
    235 }
    236 PCUT_TEST(my_test_067)
    237 {
    238 }
    239 PCUT_TEST(my_test_068)
    240 {
    241 }
    242 PCUT_TEST(my_test_069)
    243 {
    244 }
    245 PCUT_TEST(my_test_070)
    246 {
    247 }
    248 PCUT_TEST(my_test_071)
    249 {
    250 }
    251 PCUT_TEST(my_test_072)
    252 {
    253 }
    254 PCUT_TEST(my_test_073)
    255 {
    256 }
    257 PCUT_TEST(my_test_074)
    258 {
    259 }
    260 PCUT_TEST(my_test_075)
    261 {
    262 }
    263 PCUT_TEST(my_test_076)
    264 {
    265 }
    266 PCUT_TEST(my_test_077)
    267 {
    268 }
    269 PCUT_TEST(my_test_078)
    270 {
    271 }
    272 PCUT_TEST(my_test_079)
    273 {
    274 }
    275 PCUT_TEST(my_test_080)
    276 {
    277 }
     38PCUT_TEST(my_test_001) { }
     39PCUT_TEST(my_test_002) { }
     40PCUT_TEST(my_test_003) { }
     41PCUT_TEST(my_test_004) { }
     42PCUT_TEST(my_test_005) { }
     43PCUT_TEST(my_test_006) { }
     44PCUT_TEST(my_test_007) { }
     45PCUT_TEST(my_test_008) { }
     46PCUT_TEST(my_test_009) { }
     47PCUT_TEST(my_test_010) { }
     48PCUT_TEST(my_test_011) { }
     49PCUT_TEST(my_test_012) { }
     50PCUT_TEST(my_test_013) { }
     51PCUT_TEST(my_test_014) { }
     52PCUT_TEST(my_test_015) { }
     53PCUT_TEST(my_test_016) { }
     54PCUT_TEST(my_test_017) { }
     55PCUT_TEST(my_test_018) { }
     56PCUT_TEST(my_test_019) { }
     57PCUT_TEST(my_test_020) { }
     58PCUT_TEST(my_test_021) { }
     59PCUT_TEST(my_test_022) { }
     60PCUT_TEST(my_test_023) { }
     61PCUT_TEST(my_test_024) { }
     62PCUT_TEST(my_test_025) { }
     63PCUT_TEST(my_test_026) { }
     64PCUT_TEST(my_test_027) { }
     65PCUT_TEST(my_test_028) { }
     66PCUT_TEST(my_test_029) { }
     67PCUT_TEST(my_test_030) { }
     68PCUT_TEST(my_test_031) { }
     69PCUT_TEST(my_test_032) { }
     70PCUT_TEST(my_test_033) { }
     71PCUT_TEST(my_test_034) { }
     72PCUT_TEST(my_test_035) { }
     73PCUT_TEST(my_test_036) { }
     74PCUT_TEST(my_test_037) { }
     75PCUT_TEST(my_test_038) { }
     76PCUT_TEST(my_test_039) { }
     77PCUT_TEST(my_test_040) { }
     78PCUT_TEST(my_test_041) { }
     79PCUT_TEST(my_test_042) { }
     80PCUT_TEST(my_test_043) { }
     81PCUT_TEST(my_test_044) { }
     82PCUT_TEST(my_test_045) { }
     83PCUT_TEST(my_test_046) { }
     84PCUT_TEST(my_test_047) { }
     85PCUT_TEST(my_test_048) { }
     86PCUT_TEST(my_test_049) { }
     87PCUT_TEST(my_test_050) { }
     88PCUT_TEST(my_test_051) { }
     89PCUT_TEST(my_test_052) { }
     90PCUT_TEST(my_test_053) { }
     91PCUT_TEST(my_test_054) { }
     92PCUT_TEST(my_test_055) { }
     93PCUT_TEST(my_test_056) { }
     94PCUT_TEST(my_test_057) { }
     95PCUT_TEST(my_test_058) { }
     96PCUT_TEST(my_test_059) { }
     97PCUT_TEST(my_test_060) { }
     98PCUT_TEST(my_test_061) { }
     99PCUT_TEST(my_test_062) { }
     100PCUT_TEST(my_test_063) { }
     101PCUT_TEST(my_test_064) { }
     102PCUT_TEST(my_test_065) { }
     103PCUT_TEST(my_test_066) { }
     104PCUT_TEST(my_test_067) { }
     105PCUT_TEST(my_test_068) { }
     106PCUT_TEST(my_test_069) { }
     107PCUT_TEST(my_test_070) { }
     108PCUT_TEST(my_test_071) { }
     109PCUT_TEST(my_test_072) { }
     110PCUT_TEST(my_test_073) { }
     111PCUT_TEST(my_test_074) { }
     112PCUT_TEST(my_test_075) { }
     113PCUT_TEST(my_test_076) { }
     114PCUT_TEST(my_test_077) { }
     115PCUT_TEST(my_test_078) { }
     116PCUT_TEST(my_test_079) { }
     117PCUT_TEST(my_test_080) { }
    278118
    279119
    280 PCUT_MAIN();
     120PCUT_MAIN()
  • uspace/lib/pcut/tests/preinithook.c

    r275530a4 r4b54bd9  
    3030#include "tested.h"
    3131
    32 PCUT_INIT;
     32PCUT_INIT
    3333
    3434static int init_counter = 1;
    3535
    36 static void init_hook(void)
    37 {
     36static void init_hook(void) {
    3837        init_counter++;
    3938}
    4039
    41 static void pre_init_hook(int *argc, char **argv[])
    42 {
     40static void pre_init_hook(int *argc, char **argv[]) {
    4341        (void) argc;
    4442        (void) argv;
     
    4644}
    4745
    48 PCUT_TEST_BEFORE
    49 {
     46PCUT_TEST_BEFORE {
    5047        PCUT_ASSERT_INT_EQUALS(4, init_counter);
    5148        init_counter++;
    5249}
    5350
    54 PCUT_TEST(check_init_counter)
    55 {
     51PCUT_TEST(check_init_counter) {
    5652        PCUT_ASSERT_INT_EQUALS(5, init_counter);
    5753}
    5854
    59 PCUT_TEST(check_init_counter_2)
    60 {
     55PCUT_TEST(check_init_counter_2) {
    6156        PCUT_ASSERT_INT_EQUALS(5, init_counter);
    6257}
    6358
    6459
    65 PCUT_CUSTOM_MAIN(PCUT_MAIN_SET_INIT_HOOK(init_hook),
    66     PCUT_MAIN_SET_PREINIT_HOOK(pre_init_hook));
     60PCUT_CUSTOM_MAIN(
     61        PCUT_MAIN_SET_INIT_HOOK(init_hook),
     62        PCUT_MAIN_SET_PREINIT_HOOK(pre_init_hook)
     63)
    6764
  • uspace/lib/pcut/tests/printing.c

    r275530a4 r4b54bd9  
    3131#include <stdio.h>
    3232
    33 PCUT_INIT;
     33PCUT_INIT
    3434
    35 PCUT_TEST(print_to_stdout)
    36 {
     35PCUT_TEST(print_to_stdout) {
    3736        printf("Printed from a test to stdout!\n");
    3837}
    3938
    40 PCUT_TEST(print_to_stderr)
    41 {
     39PCUT_TEST(print_to_stderr) {
    4240        fprintf(stderr, "Printed from a test to stderr!\n");
    4341}
    4442
    45 PCUT_TEST(print_to_stdout_and_fail)
    46 {
     43PCUT_TEST(print_to_stdout_and_fail) {
    4744        printf("Printed from a test to stdout!\n");
    4845        PCUT_ASSERT_NOT_NULL(0);
    4946}
    5047
    51 PCUT_MAIN();
     48PCUT_MAIN()
  • uspace/lib/pcut/tests/simple.c

    r275530a4 r4b54bd9  
    3030#include "tested.h"
    3131
    32 PCUT_INIT;
     32PCUT_INIT
    3333
    34 PCUT_TEST(zero_exponent)
    35 {
     34PCUT_TEST(zero_exponent) {
    3635        PCUT_ASSERT_INT_EQUALS(1, intpow(2, 0));
    3736}
    3837
    39 PCUT_TEST(one_exponent)
    40 {
     38PCUT_TEST(one_exponent) {
    4139        PCUT_ASSERT_INT_EQUALS(2, intpow(2, 1));
    4240        PCUT_ASSERT_INT_EQUALS(39, intpow(39, 1));
    4341}
    4442
    45 PCUT_TEST(same_strings)
    46 {
     43PCUT_TEST(same_strings) {
    4744        const char *p = "xyz";
    4845        PCUT_ASSERT_STR_EQUALS("xyz", p);
     
    5047}
    5148
    52 PCUT_MAIN();
     49PCUT_MAIN()
  • uspace/lib/pcut/tests/skip.c

    r275530a4 r4b54bd9  
    3030#include "tested.h"
    3131
    32 PCUT_INIT;
     32PCUT_INIT
    3333
    34 PCUT_TEST(normal_test)
    35 {
     34PCUT_TEST(normal_test) {
    3635        PCUT_ASSERT_INT_EQUALS(1, 1);
    3736}
    3837
    39 PCUT_TEST(skipped, PCUT_TEST_SKIP)
    40 {
     38PCUT_TEST(skipped, PCUT_TEST_SKIP) {
    4139        PCUT_ASSERT_STR_EQUALS("skip", "not skipped");
    4240}
    4341
    44 PCUT_TEST(again_normal_test)
    45 {
     42PCUT_TEST(again_normal_test) {
    4643        PCUT_ASSERT_INT_EQUALS(1, 1);
    4744}
    4845
    49 PCUT_MAIN();
     46PCUT_MAIN()
  • uspace/lib/pcut/tests/suite1.c

    r275530a4 r4b54bd9  
    3030#include "tested.h"
    3131
    32 PCUT_INIT;
     32PCUT_INIT
    3333
    3434PCUT_TEST_SUITE(intpow);
    3535
    36 PCUT_TEST(zero_exponent)
    37 {
     36PCUT_TEST(zero_exponent) {
    3837        PCUT_ASSERT_INT_EQUALS(1, intpow(2, 0));
    3938}
    4039
    41 PCUT_TEST(one_exponent)
    42 {
     40PCUT_TEST(one_exponent) {
    4341        PCUT_ASSERT_INT_EQUALS(2, intpow(2, 1));
    4442        PCUT_ASSERT_INT_EQUALS(39, intpow(39, 1));
  • uspace/lib/pcut/tests/suite2.c

    r275530a4 r4b54bd9  
    3030#include "tested.h"
    3131
    32 PCUT_INIT;
     32PCUT_INIT
    3333
    3434PCUT_TEST_SUITE(intmin);
    3535
    36 PCUT_TEST(test_min)
    37 {
     36PCUT_TEST(test_min) {
    3837        PCUT_ASSERT_INT_EQUALS(5, intmin(5, 654));
    3938        PCUT_ASSERT_INT_EQUALS(5, intmin(654, 5));
     
    4241}
    4342
    44 PCUT_TEST(test_same_numbers)
    45 {
     43PCUT_TEST(test_same_numbers) {
    4644        PCUT_ASSERT_INT_EQUALS(5, intmin(5, 5));
    4745        PCUT_ASSERT_INT_EQUALS(719, intmin(719, 719));
  • uspace/lib/pcut/tests/suite_all.c

    r275530a4 r4b54bd9  
    2929#include <pcut/pcut.h>
    3030
    31 PCUT_INIT;
     31PCUT_INIT
    3232
    3333PCUT_IMPORT(intpow_suite);
    3434PCUT_IMPORT(intmin_suite);
    3535
    36 PCUT_MAIN();
     36PCUT_MAIN()
  • uspace/lib/pcut/tests/suites.c

    r275530a4 r4b54bd9  
    3030#include "tested.h"
    3131
    32 PCUT_INIT;
     32PCUT_INIT
    3333
    3434PCUT_TEST_SUITE(intpow);
    3535
    36 PCUT_TEST(zero_exponent)
    37 {
     36PCUT_TEST(zero_exponent) {
    3837        PCUT_ASSERT_INT_EQUALS(1, intpow(2, 0));
    3938}
    4039
    41 PCUT_TEST(one_exponent)
    42 {
     40PCUT_TEST(one_exponent) {
    4341        PCUT_ASSERT_INT_EQUALS(2, intpow(2, 1));
    4442        PCUT_ASSERT_INT_EQUALS(39, intpow(39, 1));
     
    4745PCUT_TEST_SUITE(intmin);
    4846
    49 PCUT_TEST(test_min)
    50 {
     47PCUT_TEST(test_min) {
    5148        PCUT_ASSERT_INT_EQUALS(5, intmin(5, 654));
    5249        PCUT_ASSERT_INT_EQUALS(5, intmin(654, 5));
     
    5552}
    5653
    57 PCUT_MAIN();
     54PCUT_MAIN()
  • uspace/lib/pcut/tests/teardown.c

    r275530a4 r4b54bd9  
    3131#include "tested.h"
    3232
    33 PCUT_INIT;
     33PCUT_INIT
    3434
    3535
     
    3737PCUT_TEST_SUITE(with_teardown);
    3838
    39 PCUT_TEST_AFTER
    40 {
     39PCUT_TEST_AFTER {
    4140        printf("This is teardown-function.\n");
    4241}
    4342
    44 PCUT_TEST(empty)
    45 {
     43PCUT_TEST(empty) {
    4644}
    4745
    48 PCUT_TEST(failing)
    49 {
     46PCUT_TEST(failing) {
    5047        PCUT_ASSERT_INT_EQUALS(10, intmin(1, 2));
    5148}
     
    5552PCUT_TEST_SUITE(with_failing_teardown);
    5653
    57 PCUT_TEST_AFTER
    58 {
     54PCUT_TEST_AFTER {
    5955        printf("This is failing teardown-function.\n");
    6056        PCUT_ASSERT_INT_EQUALS(42, intmin(10, 20));
    6157}
    6258
    63 PCUT_TEST(empty2)
    64 {
     59PCUT_TEST(empty2) {
    6560}
    6661
    67 PCUT_TEST(printing2)
    68 {
     62PCUT_TEST(printing2) {
    6963        printf("Printed before test failure.\n");
    7064        PCUT_ASSERT_INT_EQUALS(0, intmin(-17, -19));
    7165}
    7266
    73 PCUT_TEST(failing2)
    74 {
     67PCUT_TEST(failing2) {
    7568        PCUT_ASSERT_INT_EQUALS(12, intmin(3, 5));
    7669}
    7770
    7871
    79 PCUT_MAIN();
     72PCUT_MAIN()
  • uspace/lib/pcut/tests/teardownaborts.c

    r275530a4 r4b54bd9  
    3131#include <stdlib.h>
    3232
    33 PCUT_INIT;
     33PCUT_INIT
    3434
    35 PCUT_TEST_AFTER
    36 {
     35PCUT_TEST_AFTER {
    3736        abort();
    3837}
    3938
    40 PCUT_TEST(print_and_fail)
    41 {
     39PCUT_TEST(print_and_fail) {
    4240        printf("Tear-down will cause null pointer access...\n");
    4341        PCUT_ASSERT_NOT_NULL(NULL);
    4442}
    4543
    46 PCUT_MAIN();
     44PCUT_MAIN()
  • uspace/lib/pcut/tests/tested.c

    r275530a4 r4b54bd9  
    3131#define UNUSED(a) ((void)a)
    3232
    33 long intpow(int base, int exp)
    34 {
    35         UNUSED(base);
    36         UNUSED(exp);
     33long intpow(int base, int exp) {
     34        UNUSED(base); UNUSED(exp);
    3735        return 0;
    3836}
    3937
    40 int intmin(int a, int b)
    41 {
     38int intmin(int a, int b) {
    4239        UNUSED(b);
    4340        return a;
  • uspace/lib/pcut/tests/testlist.c

    r275530a4 r4b54bd9  
    3030#include "tested.h"
    3131
    32 PCUT_INIT;
     32PCUT_INIT
    3333
    3434static char *argv_patched[] = {
     
    3838};
    3939
    40 static void pre_init_hook(int *argc, char **argv[])
    41 {
     40static void pre_init_hook(int *argc, char **argv[]) {
    4241        argv_patched[0] = (*argv)[0];
    4342        *argc = 2;
     
    4544}
    4645
    47 PCUT_TEST(unreachable)
    48 {
     46PCUT_TEST(unreachable) {
    4947        PCUT_ASSERT_TRUE(0 && "unreachable code");
    5048}
    5149
    5250
    53 PCUT_CUSTOM_MAIN(PCUT_MAIN_SET_PREINIT_HOOK(pre_init_hook));
     51PCUT_CUSTOM_MAIN(
     52        PCUT_MAIN_SET_PREINIT_HOOK(pre_init_hook)
     53)
    5454
  • uspace/lib/pcut/tests/timeout.c

    r275530a4 r4b54bd9  
    11/*
    2  * Copyright (c) 2012-2013 Vojtech Horky
     2 * Copyright (c) 2012-2018 Vojtech Horky
    33 * All rights reserved.
    44 *
     
    3232#include <fibril.h>
    3333#else
    34 #ifdef __unix
     34#if defined(__unix) || defined(__APPLE__)
    3535#include <unistd.h>
    3636#endif
     
    4343#include "tested.h"
    4444
    45 static void my_sleep(int sec)
    46 {
     45static void my_sleep(int sec) {
    4746#ifdef __helenos__
    4847        fibril_sleep(sec);
    4948#else
    50 #ifdef __unix
     49#if defined(__unix) || defined(__APPLE__)
    5150        sleep(sec);
    5251#endif
     
    5756}
    5857
    59 PCUT_INIT;
     58PCUT_INIT
    6059
    61 PCUT_TEST(shall_time_out)
    62 {
     60PCUT_TEST(shall_time_out) {
    6361        printf("Text before sleeping.\n");
    6462        my_sleep(PCUT_DEFAULT_TEST_TIMEOUT * 5);
     
    6765
    6866PCUT_TEST(custom_time_out,
    69     PCUT_TEST_SET_TIMEOUT(PCUT_DEFAULT_TEST_TIMEOUT * 3))
    70 {
     67                PCUT_TEST_SET_TIMEOUT(PCUT_DEFAULT_TEST_TIMEOUT * 3)) {
    7168        printf("Text before sleeping.\n");
    7269        my_sleep(PCUT_DEFAULT_TEST_TIMEOUT * 2);
     
    7471}
    7572
    76 PCUT_MAIN();
     73PCUT_MAIN()
  • uspace/lib/pcut/tests/xmlreport.c

    r275530a4 r4b54bd9  
    3333#include "tested.h"
    3434
    35 PCUT_INIT;
     35PCUT_INIT
    3636
    37 PCUT_TEST(zero_exponent)
    38 {
     37PCUT_TEST(zero_exponent) {
    3938        PCUT_ASSERT_INT_EQUALS(1, intpow(2, 0));
    4039}
    4140
    42 PCUT_TEST(one_exponent)
    43 {
     41PCUT_TEST(one_exponent) {
    4442        PCUT_ASSERT_INT_EQUALS(2, intpow(2, 1));
    4543        PCUT_ASSERT_INT_EQUALS(39, intpow(39, 1));
    4644}
    4745
    48 PCUT_TEST(same_strings)
    49 {
     46PCUT_TEST(same_strings) {
    5047        const char *p = "xyz";
    5148        PCUT_ASSERT_STR_EQUALS("xyz", p);
     
    5350}
    5451
    55 PCUT_CUSTOM_MAIN(PCUT_MAIN_SET_XML_REPORT);
     52PCUT_CUSTOM_MAIN(
     53        PCUT_MAIN_SET_XML_REPORT
     54)
Note: See TracChangeset for help on using the changeset viewer.