Changeset c24b0dcb in mainline for uspace/lib/c/test/capa.c
- Timestamp:
- 2019-09-30T16:38:33Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8f57fb2
- Parents:
- ef0a3375
- git-author:
- Jakub Jermar <jakub@…> (2019-09-30 16:34:10)
- git-committer:
- Jakub Jermar <jakub@…> (2019-09-30 16:38:33)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/test/capa.c
ref0a3375 rc24b0dcb 28 28 29 29 #include <pcut/pcut.h> 30 #include <cap .h>30 #include <capa.h> 31 31 32 32 PCUT_INIT; 33 33 34 PCUT_TEST_SUITE(cap );35 36 PCUT_TEST(cap _format)34 PCUT_TEST_SUITE(capa); 35 36 PCUT_TEST(capa_format) 37 37 { 38 38 int block_size = 4; … … 86 86 }; 87 87 88 cap _spec_t cap;88 capa_spec_t capa; 89 89 char *str; 90 90 errno_t rc; … … 93 93 for (i = 0; i < input_size; i++) { 94 94 for (x = 0; x < block_size; x++) { 95 cap _from_blocks(input[i], block[x], &cap);96 cap _simplify(&cap);97 98 rc = cap _format(&cap, &str);95 capa_from_blocks(input[i], block[x], &capa); 96 capa_simplify(&capa); 97 98 rc = capa_format(&capa, &str); 99 99 100 100 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 102 102 free(str); 103 103 104 cap _from_blocks(block[x], input[i], &cap);105 cap _simplify(&cap);106 107 rc = cap _format(&cap, &str);104 capa_from_blocks(block[x], input[i], &capa); 105 capa_simplify(&capa); 106 107 rc = capa_format(&capa, &str); 108 108 109 109 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 114 114 } 115 115 116 PCUT_TEST(cap _format_rounding)116 PCUT_TEST(capa_format_rounding) 117 117 { 118 118 int input_size = 8; … … 139 139 }; 140 140 141 cap _spec_t cap;141 capa_spec_t capa; 142 142 char *str; 143 143 errno_t rc; … … 145 145 int i; 146 146 for (i = 0; i < input_size; i++) { 147 cap _from_blocks(input[i], 1, &cap);148 cap _simplify(&cap);149 150 rc = cap _format(&cap, &str);147 capa_from_blocks(input[i], 1, &capa); 148 capa_simplify(&capa); 149 150 rc = capa_format(&capa, &str); 151 151 152 152 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 154 154 free(str); 155 155 156 cap _from_blocks(1, input[i], &cap);157 cap _simplify(&cap);158 159 rc = cap _format(&cap, &str);156 capa_from_blocks(1, input[i], &capa); 157 capa_simplify(&capa); 158 159 rc = capa_format(&capa, &str); 160 160 161 161 PCUT_ASSERT_ERRNO_VAL(EOK, rc); … … 165 165 } 166 166 167 PCUT_TEST(cap _parse)167 PCUT_TEST(capa_parse) 168 168 { 169 169 int input_size = 4; … … 196 196 }; 197 197 198 cap _spec_t cap;198 capa_spec_t capa; 199 199 errno_t rc; 200 200 int i; 201 201 202 202 for (i = 0; i < input_size; i++) { 203 rc = cap _parse(input[i], &cap);204 205 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 206 PCUT_ASSERT_INT_EQUALS(out_cunit[i], cap .cunit);207 PCUT_ASSERT_INT_EQUALS(out_dp[i], cap .dp);208 PCUT_ASSERT_INT_EQUALS(out_m[i], cap .m);209 } 210 } 211 212 PCUT_TEST(cap _to_blocks)203 rc = capa_parse(input[i], &capa); 204 205 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 206 PCUT_ASSERT_INT_EQUALS(out_cunit[i], capa.cunit); 207 PCUT_ASSERT_INT_EQUALS(out_dp[i], capa.dp); 208 PCUT_ASSERT_INT_EQUALS(out_m[i], capa.m); 209 } 210 } 211 212 PCUT_TEST(capa_to_blocks) 213 213 { 214 214 int input_size = 0; … … 261 261 }; 262 262 263 cap _spec_t cap;263 capa_spec_t capa; 264 264 errno_t rc; 265 265 int i; … … 267 267 268 268 for (i = 0; i < input_size; i++) { 269 cap .m = input_m[i];270 cap .dp = input_dp[i];271 cap .cunit = cu_kbyte;272 273 rc = cap _to_blocks(&cap, cv_nom, block[i], &ret);269 capa.m = input_m[i]; 270 capa.dp = input_dp[i]; 271 capa.cunit = cu_kbyte; 272 273 rc = capa_to_blocks(&capa, cv_nom, block[i], &ret); 274 274 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 275 275 PCUT_ASSERT_INT_EQUALS(out_nom[i], ret); 276 276 277 rc = cap _to_blocks(&cap, cv_min, block[i], &ret);277 rc = capa_to_blocks(&capa, cv_min, block[i], &ret); 278 278 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 279 279 PCUT_ASSERT_INT_EQUALS(out_min[i], ret); 280 280 281 rc = cap _to_blocks(&cap, cv_max, block[i], &ret);281 rc = capa_to_blocks(&capa, cv_max, block[i], &ret); 282 282 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 283 283 PCUT_ASSERT_INT_EQUALS(out_max[i], ret); … … 285 285 } 286 286 287 PCUT_EXPORT(cap );287 PCUT_EXPORT(capa);
Note:
See TracChangeset
for help on using the changeset viewer.