Discovered cl_git_strequal! Mounted a crusade!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661
diff --git a/tests-clar/buf/basic.c b/tests-clar/buf/basic.c
index b025c99..5d4a5ff 100644
--- a/tests-clar/buf/basic.c
+++ b/tests-clar/buf/basic.c
@@ -8,7 +8,7 @@ void test_buf_basic__resize(void)
git_buf buf1 = GIT_BUF_INIT;
git_buf_puts(&buf1, test_string);
cl_assert(git_buf_oom(&buf1) == 0);
- cl_assert(strcmp(git_buf_cstr(&buf1), test_string) == 0);
+ cl_assert_strequal(git_buf_cstr(&buf1), test_string);
git_buf_puts(&buf1, test_string);
cl_assert(strlen(git_buf_cstr(&buf1)) == strlen(test_string) * 2);
@@ -20,10 +20,10 @@ void test_buf_basic__printf(void)
git_buf buf2 = GIT_BUF_INIT;
git_buf_printf(&buf2, "%s %s %d ", "shoop", "da", 23);
cl_assert(git_buf_oom(&buf2) == 0);
- cl_assert(strcmp(git_buf_cstr(&buf2), "shoop da 23 ") == 0);
+ cl_assert_strequal(git_buf_cstr(&buf2), "shoop da 23 ");
git_buf_printf(&buf2, "%s %d", "woop", 42);
cl_assert(git_buf_oom(&buf2) == 0);
- cl_assert(strcmp(git_buf_cstr(&buf2), "shoop da 23 woop 42") == 0);
+ cl_assert_strequal(git_buf_cstr(&buf2), "shoop da 23 woop 42");
git_buf_free(&buf2);
}
diff --git a/tests-clar/config/multivar.c b/tests-clar/config/multivar.c
index 9a411f0..d3784c0 100644
--- a/tests-clar/config/multivar.c
+++ b/tests-clar/config/multivar.c
@@ -21,7 +21,7 @@ static int mv_read_cb(const char *name, const char *value, void *data)
if (!strcmp(name, _name))
(*n)++;
- return 0;
+ return GIT_SUCCESS;
}
void test_config_multivar__foreach(void)
diff --git a/tests-clar/config/new.c b/tests-clar/config/new.c
index 96aed2b..651e739 100644
--- a/tests-clar/config/new.c
+++ b/tests-clar/config/new.c
@@ -26,9 +26,9 @@ void test_config_new__write_new_config(void)
cl_git_pass(git_config_add_file(config, file, 0));
cl_git_pass(git_config_get_string(config, "color.ui", &out));
- cl_assert(strcmp(out, "auto") == 0);
+ cl_assert_strequal(out, "auto");
cl_git_pass(git_config_get_string(config, "core.editor", &out));
- cl_assert(strcmp(out, "ed") == 0);
+ cl_assert_strequal(out, "ed");
git_config_free(config);
diff --git a/tests-clar/config/read.c b/tests-clar/config/read.c
index 26e6f42..2813048 100644
--- a/tests-clar/config/read.c
+++ b/tests-clar/config/read.c
@@ -28,9 +28,9 @@ void test_config_read__case_sensitive(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config1")));
cl_git_pass(git_config_get_string(cfg, "this.that.other", &str));
- cl_assert(!strcmp(str, "true"));
+ cl_assert_strequal(str, "true");
cl_git_pass(git_config_get_string(cfg, "this.That.other", &str));
- cl_assert(!strcmp(str, "yes"));
+ cl_assert_strequal(str, "yes");
cl_git_pass(git_config_get_bool(cfg, "this.that.other", &i));
cl_assert(i == 1);
@@ -55,7 +55,7 @@ void test_config_read__multiline_value(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config2")));
cl_git_pass(git_config_get_string(cfg, "this.That.and", &str));
- cl_assert(!strcmp(str, "one one one two two three three"));
+ cl_assert_strequal(str, "one one one two two three three");
git_config_free(cfg);
}
@@ -71,7 +71,7 @@ void test_config_read__subsection_header(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config3")));
cl_git_pass(git_config_get_string(cfg, "section.subsection.var", &str));
- cl_assert(!strcmp(str, "hello"));
+ cl_assert_strequal(str, "hello");
/* The subsection is transformed to lower-case */
cl_must_fail(git_config_get_string(cfg, "section.subSectIon.var", &str));
@@ -171,10 +171,10 @@ void test_config_read__prefixes(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config9")));
cl_git_pass(git_config_get_string(cfg, "remote.ab.url", &str));
- cl_assert(strcmp(str, "http://example.com/git/ab") == 0);
+ cl_assert_strequal(str, "http://example.com/git/ab");
cl_git_pass(git_config_get_string(cfg, "remote.abba.url", &str));
- cl_assert(strcmp(str, "http://example.com/git/abba") == 0);
+ cl_assert_strequal(str, "http://example.com/git/abba");
git_config_free(cfg);
}
diff --git a/tests-clar/index/tests.c b/tests-clar/index/tests.c
index 0f075a0..9edcabe 100644
--- a/tests-clar/index/tests.c
+++ b/tests-clar/index/tests.c
@@ -106,7 +106,7 @@ void test_index_tests__default_test_index(void)
for (i = 0; i < ARRAY_SIZE(test_entries); ++i) {
git_index_entry *e = entries[test_entries[i].index];
- cl_assert(strcmp(e->path, test_entries[i].path) == 0);
+ cl_assert_strequal(e->path, test_entries[i].path);
cl_assert(e->mtime.seconds == test_entries[i].mtime);
cl_assert(e->file_size == test_entries[i].file_size);
}
diff --git a/tests-clar/network/createremotethenload.c b/tests-clar/network/createremotethenload.c
index 68ba929..a805e2d 100644
--- a/tests-clar/network/createremotethenload.c
+++ b/tests-clar/network/createremotethenload.c
@@ -28,6 +28,6 @@ void test_network_createremotethenload__cleanup(void)
void test_network_createremotethenload__parsing(void)
{
- cl_assert(!strcmp(git_remote_name(_remote), "origin"));
- cl_assert(!strcmp(git_remote_url(_remote), url));
+ cl_assert_strequal(git_remote_name(_remote), "origin");
+ cl_assert_strequal(git_remote_url(_remote), url);
}
diff --git a/tests-clar/network/remotes.c b/tests-clar/network/remotes.c
index add99c1..5dc5f33 100644
--- a/tests-clar/network/remotes.c
+++ b/tests-clar/network/remotes.c
@@ -27,8 +27,8 @@ void test_network_remotes__cleanup(void)
void test_network_remotes__parsing(void)
{
- cl_assert(!strcmp(git_remote_name(_remote), "test"));
- cl_assert(!strcmp(git_remote_url(_remote), "git://github.com/libgit2/libgit2"));
+ cl_assert_strequal(git_remote_name(_remote), "test");
+ cl_assert_strequal(git_remote_url(_remote), "git://github.com/libgit2/libgit2");
}
void test_network_remotes__parsing_ssh_remote(void)
@@ -53,24 +53,24 @@ void test_network_remotes__unsupported_transport_methods_are_unsupported(void)
void test_network_remotes__refspec_parsing(void)
{
- cl_assert(!strcmp(git_refspec_src(_refspec), "refs/heads/*"));
- cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/remotes/test/*"));
+ cl_assert_strequal(git_refspec_src(_refspec), "refs/heads/*");
+ cl_assert_strequal(git_refspec_dst(_refspec), "refs/remotes/test/*");
}
void test_network_remotes__set_fetchspec(void)
{
cl_git_pass(git_remote_set_fetchspec(_remote, "refs/*:refs/*"));
_refspec = git_remote_fetchspec(_remote);
- cl_assert(!strcmp(git_refspec_src(_refspec), "refs/*"));
- cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/*"));
+ cl_assert_strequal(git_refspec_src(_refspec), "refs/*");
+ cl_assert_strequal(git_refspec_dst(_refspec), "refs/*");
}
void test_network_remotes__set_pushspec(void)
{
cl_git_pass(git_remote_set_pushspec(_remote, "refs/*:refs/*"));
_refspec = git_remote_pushspec(_remote);
- cl_assert(!strcmp(git_refspec_src(_refspec), "refs/*"));
- cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/*"));
+ cl_assert_strequal(git_refspec_src(_refspec), "refs/*");
+ cl_assert_strequal(git_refspec_dst(_refspec), "refs/*");
}
void test_network_remotes__save(void)
@@ -90,13 +90,13 @@ void test_network_remotes__save(void)
_refspec = git_remote_fetchspec(_remote);
cl_assert(_refspec != NULL);
- cl_assert(!strcmp(git_refspec_src(_refspec), "refs/heads/*"));
- cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/remotes/upstream/*"));
+ cl_assert_strequal(git_refspec_src(_refspec), "refs/heads/*");
+ cl_assert_strequal(git_refspec_dst(_refspec), "refs/remotes/upstream/*");
_refspec = git_remote_pushspec(_remote);
cl_assert(_refspec != NULL);
- cl_assert(!strcmp(git_refspec_src(_refspec), "refs/heads/*"));
- cl_assert(!strcmp(git_refspec_dst(_refspec), "refs/heads/*"));
+ cl_assert_strequal(git_refspec_src(_refspec), "refs/heads/*");
+ cl_assert_strequal(git_refspec_dst(_refspec), "refs/heads/*");
}
void test_network_remotes__fnmatch(void)
@@ -111,7 +111,7 @@ void test_network_remotes__transform(void)
memset(ref, 0x0, sizeof(ref));
cl_git_pass(git_refspec_transform(ref, sizeof(ref), _refspec, "refs/heads/master"));
- cl_assert(!strcmp(ref, "refs/remotes/test/master"));
+ cl_assert_strequal(ref, "refs/remotes/test/master");
}
void test_network_remotes__transform_r(void)
@@ -119,7 +119,7 @@ void test_network_remotes__transform_r(void)
git_buf buf = GIT_BUF_INIT;
cl_git_pass(git_refspec_transform_r(&buf, _refspec, "refs/heads/master"));
- cl_assert(!strcmp(git_buf_cstr(&buf), "refs/remotes/test/master"));
+ cl_assert_strequal(git_buf_cstr(&buf), "refs/remotes/test/master");
git_buf_free(&buf);
}
diff --git a/tests-clar/notes/notes.c b/tests-clar/notes/notes.c
index 0e9a165..bb5a85d 100644
--- a/tests-clar/notes/notes.c
+++ b/tests-clar/notes/notes.c
@@ -33,11 +33,11 @@ void test_notes_notes__1(void)
cl_git_pass(git_note_read(&_note, _repo, NULL, &oid));
- cl_assert(!strcmp(git_note_message(_note), "hello world\n"));
+ cl_assert_strequal(git_note_message(_note), "hello world\n");
cl_assert(!git_oid_cmp(git_note_oid(_note), ¬e_oid));
cl_git_pass(git_blob_lookup(&_blob, _repo, ¬e_oid));
- cl_assert(!strcmp(git_note_message(_note), git_blob_rawcontent(_blob)));
+ cl_assert_strequal(git_note_message(_note), git_blob_rawcontent(_blob));
cl_git_fail(git_note_create(¬e_oid, _repo, _sig, _sig, NULL, &oid, "hello world\n"));
cl_git_fail(git_note_create(¬e_oid, _repo, _sig, _sig, "refs/notes/some/namespace", &oid, "hello world\n"));
diff --git a/tests-clar/object/raw/compare.c b/tests-clar/object/raw/compare.c
index 22f9580..6dc6d71 100644
--- a/tests-clar/object/raw/compare.c
+++ b/tests-clar/object/raw/compare.c
@@ -87,7 +87,7 @@ void test_object_raw_compare__compare_fmt_oids(void)
/* Format produced the right result */
out[GIT_OID_HEXSZ] = '\0';
- cl_assert(strcmp(exp, out) == 0);
+ cl_assert_strequal(exp, out);
}
void test_object_raw_compare__compare_allocfmt_oids(void)
@@ -100,7 +100,7 @@ void test_object_raw_compare__compare_allocfmt_oids(void)
out = git_oid_allocfmt(&in);
cl_assert(out);
- cl_assert(strcmp(exp, out) == 0);
+ cl_assert_strequal(exp, out);
git__free(out);
}
@@ -120,5 +120,5 @@ void test_object_raw_compare__compare_pathfmt_oids(void)
/* Format produced the right result */
out[GIT_OID_HEXSZ + 1] = '\0';
- cl_assert(strcmp(exp2, out) == 0);
+ cl_assert_strequal(exp2, out);
}
diff --git a/tests-clar/object/raw/convert.c b/tests-clar/object/raw/convert.c
index b5b879e..4e7aecf 100644
--- a/tests-clar/object/raw/convert.c
+++ b/tests-clar/object/raw/convert.c
@@ -45,7 +45,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion(void)
/* returns out as hex formatted c-string */
str = git_oid_tostr(out, sizeof(out), &in);
cl_assert(str && str == out && *(str+GIT_OID_HEXSZ) == '\0');
- cl_assert(strcmp(exp, out) == 0);
+ cl_assert_strequal(exp, out);
}
void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
@@ -66,7 +66,7 @@ void test_object_raw_convert__succeed_on_oid_to_string_conversion_big(void)
/* returns big as hex formatted c-string */
str = git_oid_tostr(big, sizeof(big), &in);
cl_assert(str && str == big && *(str+GIT_OID_HEXSZ) == '\0');
- cl_assert(strcmp(exp, big) == 0);
+ cl_assert_strequal(exp, big);
/* check tail material is untouched */
cl_assert(str && str == big && *(str+GIT_OID_HEXSZ+1) == 'X');
diff --git a/tests-clar/object/raw/type2string.c b/tests-clar/object/raw/type2string.c
index 24ed1c4..2092d2c 100644
--- a/tests-clar/object/raw/type2string.c
+++ b/tests-clar/object/raw/type2string.c
@@ -6,19 +6,19 @@
void test_object_raw_type2string__convert_type_to_string(void)
{
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ_BAD), ""));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ__EXT1), ""));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ_COMMIT), "commit"));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ_TREE), "tree"));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ_BLOB), "blob"));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ_TAG), "tag"));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ__EXT2), ""));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ_OFS_DELTA), "OFS_DELTA"));
- cl_assert(!strcmp(git_object_type2string(GIT_OBJ_REF_DELTA), "REF_DELTA"));
-
- cl_assert(!strcmp(git_object_type2string(-2), ""));
- cl_assert(!strcmp(git_object_type2string(8), ""));
- cl_assert(!strcmp(git_object_type2string(1234), ""));
+ cl_assert_strequal(git_object_type2string(GIT_OBJ_BAD), "");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ__EXT1), "");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ_COMMIT), "commit");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ_TREE), "tree");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ_BLOB), "blob");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ_TAG), "tag");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ__EXT2), "");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ_OFS_DELTA), "OFS_DELTA");
+ cl_assert_strequal(git_object_type2string(GIT_OBJ_REF_DELTA), "REF_DELTA");
+
+ cl_assert_strequal(git_object_type2string(-2), "");
+ cl_assert_strequal(git_object_type2string(8), "");
+ cl_assert_strequal(git_object_type2string(1234), "");
}
void test_object_raw_type2string__convert_string_to_type(void)
diff --git a/tests-clar/object/tag/read.c b/tests-clar/object/tag/read.c
index 812e6ee..d0140c0 100644
--- a/tests-clar/object/tag/read.c
+++ b/tests-clar/object/tag/read.c
@@ -54,7 +54,7 @@ void test_object_tag_read__parse(void)
cl_git_pass(git_tag_lookup(&tag1, g_repo, &id1));
- cl_assert(strcmp(git_tag_name(tag1), "test") == 0);
+ cl_assert_strequal(git_tag_name(tag1), "test");
cl_assert(git_tag_type(tag1) == GIT_OBJ_TAG);
cl_git_pass(git_tag_target((git_object **)&tag2, tag1));
@@ -113,7 +113,7 @@ void test_object_tag_read__parse_without_tagger(void)
cl_git_pass(git_tag_lookup(&bad_tag, bad_tag_repo, &id));
cl_assert(bad_tag != NULL);
- cl_assert(strcmp(git_tag_name(bad_tag), "e90810b") == 0);
+ cl_assert_strequal(git_tag_name(bad_tag), "e90810b");
cl_assert(git_oid_cmp(&id, git_tag_id(bad_tag)) == 0);
cl_assert(bad_tag->tagger == NULL);
diff --git a/tests-clar/object/tag/write.c b/tests-clar/object/tag/write.c
index 5b0b8b0..27801f7 100644
--- a/tests-clar/object/tag/write.c
+++ b/tests-clar/object/tag/write.c
@@ -103,12 +103,12 @@ void test_object_tag_write__basic(void)
/* Check attributes were set correctly */
tagger1 = git_tag_tagger(tag);
cl_assert(tagger1 != NULL);
- cl_assert(strcmp(tagger1->name, tagger_name) == 0);
- cl_assert(strcmp(tagger1->email, tagger_email) == 0);
+ cl_assert_strequal(tagger1->name, tagger_name);
+ cl_assert_strequal(tagger1->email, tagger_email);
cl_assert(tagger1->when.time == 123456789);
cl_assert(tagger1->when.offset == 60);
- cl_assert(strcmp(git_tag_message(tag), tagger_message) == 0);
+ cl_assert_strequal(git_tag_message(tag), tagger_message);
cl_git_pass(git_reference_lookup(&ref_tag, g_repo, "refs/tags/the-tag"));
cl_assert(git_oid_cmp(git_reference_oid(ref_tag), &tag_id) == 0);
diff --git a/tests-clar/object/tree/diff.c b/tests-clar/object/tree/diff.c
index d481b6f..011080c 100644
--- a/tests-clar/object/tree/diff.c
+++ b/tests-clar/object/tree/diff.c
@@ -18,7 +18,7 @@ static void diff_cmp(const git_tree_diff_data *a, const git_tree_diff_data *b)
cl_assert(a->status - b->status == 0);
- cl_assert(strcmp(a->path, b->path) == 0);
+ cl_assert_strequal(a->path, b->path);
}
static int diff_cb(const git_tree_diff_data *diff, void *data)
diff --git a/tests-clar/object/tree/read.c b/tests-clar/object/tree/read.c
index 7abc723..fc2b44b 100644
--- a/tests-clar/object/tree/read.c
+++ b/tests-clar/object/tree/read.c
@@ -65,7 +65,7 @@ void test_object_tree_read__two(void)
entry = git_tree_entry_byname(tree, "README");
cl_assert(entry != NULL);
- cl_assert(strcmp(git_tree_entry_name(entry), "README") == 0);
+ cl_assert_strequal(git_tree_entry_name(entry), "README");
cl_git_pass(git_tree_entry_2object(&obj, g_repo, entry));
cl_assert(obj != NULL);
diff --git a/tests-clar/refs/create.c b/tests-clar/refs/create.c
index 8f64c51..e8f99a2 100644
--- a/tests-clar/refs/create.c
+++ b/tests-clar/refs/create.c
@@ -46,7 +46,7 @@ void test_ref_create__symbolic(void)
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker));
cl_assert(git_reference_type(looked_up_ref) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_is_packed(looked_up_ref) == 0);
- cl_assert(strcmp(looked_up_ref->name, new_head_tracker) == 0);
+ cl_assert_strequal(looked_up_ref->name, new_head_tracker);
/* ...peeled.. */
cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
@@ -116,7 +116,7 @@ void test_ref_create__oid(void)
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head));
cl_assert(git_reference_type(looked_up_ref) & GIT_REF_OID);
cl_assert(git_reference_is_packed(looked_up_ref) == 0);
- cl_assert(strcmp(looked_up_ref->name, new_head) == 0);
+ cl_assert_strequal(looked_up_ref->name, new_head);
/* ...and that it points to the current master tip */
cl_assert(git_oid_cmp(&id, git_reference_oid(looked_up_ref)) == 0);
diff --git a/tests-clar/refs/overwrite.c b/tests-clar/refs/overwrite.c
index 24e72f5..60d3149 100644
--- a/tests-clar/refs/overwrite.c
+++ b/tests-clar/refs/overwrite.c
@@ -38,7 +38,7 @@ void test_ref_overwrite__symbolic(void)
/* Ensure it points to the right place*/
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
- cl_assert(!strcmp(git_reference_target(ref), ref_branch_name));
+ cl_assert_strequal(git_reference_target(ref), ref_branch_name);
git_reference_free(ref);
/* Ensure we can't create it unless we force it to */
@@ -49,7 +49,7 @@ void test_ref_overwrite__symbolic(void)
/* Ensure it points to the right place */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
- cl_assert(!strcmp(git_reference_target(ref), ref_master_name));
+ cl_assert_strequal(git_reference_target(ref), ref_master_name);
git_reference_free(ref);
git_reference_free(branch_ref);
@@ -107,7 +107,7 @@ void test_ref_overwrite__object_id_with_symbolic(void)
/* Ensure it points to the right place */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_SYMBOLIC);
- cl_assert(!strcmp(git_reference_target(ref), ref_master_name));
+ cl_assert_strequal(git_reference_target(ref), ref_master_name);
git_reference_free(ref);
}
diff --git a/tests-clar/refs/pack.c b/tests-clar/refs/pack.c
index 232aa75..6bb42cd 100644
--- a/tests-clar/refs/pack.c
+++ b/tests-clar/refs/pack.c
@@ -43,7 +43,7 @@ void test_ref_pack__loose(void)
/* Ensure a known loose ref can be looked up */
cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
cl_assert(git_reference_is_packed(reference) == 0);
- cl_assert(strcmp(reference->name, loose_tag_ref_name) == 0);
+ cl_assert_strequal(reference->name, loose_tag_ref_name);
git_reference_free(reference);
/*
@@ -60,7 +60,7 @@ void test_ref_pack__loose(void)
/* Ensure the known ref can still be looked up but is now packed */
cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
cl_assert(git_reference_is_packed(reference));
- cl_assert(strcmp(reference->name, loose_tag_ref_name) == 0);
+ cl_assert_strequal(reference->name, loose_tag_ref_name);
/* Ensure the known ref has been removed from the loose folder structure */
cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, loose_tag_ref_name));
diff --git a/tests-clar/refs/read.c b/tests-clar/refs/read.c
index 560ec56..f26fb63 100644
--- a/tests-clar/refs/read.c
+++ b/tests-clar/refs/read.c
@@ -39,7 +39,7 @@ void test_ref_read__loose_tag(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
cl_assert(git_reference_type(reference) & GIT_REF_OID);
cl_assert(git_reference_is_packed(reference) == 0);
- cl_assert(strcmp(reference->name, loose_tag_ref_name) == 0);
+ cl_assert_strequal(reference->name, loose_tag_ref_name);
cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY));
cl_assert(object != NULL);
@@ -47,7 +47,7 @@ void test_ref_read__loose_tag(void)
/* Ensure the name of the tag matches the name of the reference */
cl_git_pass(git_buf_joinpath(&ref_name_from_tag_name, GIT_REFS_TAGS_DIR, git_tag_name((git_tag *)object)));
- cl_assert(strcmp(ref_name_from_tag_name.ptr, loose_tag_ref_name) == 0);
+ cl_assert_strequal(ref_name_from_tag_name.ptr, loose_tag_ref_name);
git_buf_free(&ref_name_from_tag_name);
git_object_free(object);
@@ -76,7 +76,7 @@ void test_ref_read__symbolic(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_is_packed(reference) == 0);
- cl_assert(strcmp(reference->name, GIT_HEAD_FILE) == 0);
+ cl_assert_strequal(reference->name, GIT_HEAD_FILE);
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
@@ -104,7 +104,7 @@ void test_ref_read__nested_symbolic(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, head_tracker_sym_ref_name));
cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC);
cl_assert(git_reference_is_packed(reference) == 0);
- cl_assert(strcmp(reference->name, head_tracker_sym_ref_name) == 0);
+ cl_assert_strequal(reference->name, head_tracker_sym_ref_name);
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
@@ -172,7 +172,7 @@ void test_ref_read__packed(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, packed_head_name));
cl_assert(git_reference_type(reference) & GIT_REF_OID);
cl_assert(git_reference_is_packed(reference));
- cl_assert(strcmp(reference->name, packed_head_name) == 0);
+ cl_assert_strequal(reference->name, packed_head_name);
cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY));
cl_assert(object != NULL);
@@ -193,7 +193,7 @@ void test_ref_read__loose_first(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, packed_test_head_name));
cl_assert(git_reference_type(reference) & GIT_REF_OID);
cl_assert(git_reference_is_packed(reference) == 0);
- cl_assert(strcmp(reference->name, packed_test_head_name) == 0);
+ cl_assert_strequal(reference->name, packed_test_head_name);
git_reference_free(reference);
}
diff --git a/tests-clar/refs/reflog.c b/tests-clar/refs/reflog.c
index b646ff6..8000e48 100644
--- a/tests-clar/refs/reflog.c
+++ b/tests-clar/refs/reflog.c
@@ -16,8 +16,8 @@ static git_repository *g_repo;
static void assert_signature(git_signature *expected, git_signature *actual)
{
cl_assert(actual);
- cl_assert(0 == strcmp(expected->name, actual->name));
- cl_assert(0 == strcmp(expected->email, actual->email));
+ cl_assert_strequal(expected->name, actual->name);
+ cl_assert_strequal(expected->email, actual->email);
cl_assert(expected->when.offset == actual->when.offset);
cl_assert(expected->when.time == actual->when.time);
}
@@ -73,18 +73,18 @@ void test_refs_reflog__write_then_read(void)
entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 0);
assert_signature(committer, entry->committer);
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old);
- cl_assert(strcmp("0000000000000000000000000000000000000000", oid_str) == 0);
+ cl_assert_strequal("0000000000000000000000000000000000000000", oid_str);
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur);
- cl_assert(strcmp(current_master_tip, oid_str) == 0);
+ cl_assert_strequal(current_master_tip, oid_str);
cl_assert(entry->msg == NULL);
entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 1);
assert_signature(committer, entry->committer);
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old);
- cl_assert(strcmp(current_master_tip, oid_str) == 0);
+ cl_assert_strequal(current_master_tip, oid_str);
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur);
- cl_assert(strcmp(current_master_tip, oid_str) == 0);
- cl_assert(strcmp(commit_msg, entry->msg) == 0);
+ cl_assert_strequal(current_master_tip, oid_str);
+ cl_assert_strequal(commit_msg, entry->msg);
git_signature_free(committer);
git_reflog_free(reflog);
diff --git a/tests-clar/refs/rename.c b/tests-clar/refs/rename.c
index eec8e98..8e7c93c 100644
--- a/tests-clar/refs/rename.c
+++ b/tests-clar/refs/rename.c
@@ -48,14 +48,14 @@ void test_refs_rename__loose(void)
/* Now that the reference is renamed... */
cl_git_pass(git_reference_rename(looked_up_ref, new_name, 0));
- cl_assert(!strcmp(looked_up_ref->name, new_name));
+ cl_assert_strequal(looked_up_ref->name, new_name);
/* ...It can't be looked-up with the old name... */
cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, loose_tag_ref_name));
/* ...but the new name works ok... */
cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, new_name));
- cl_assert(!strcmp(another_looked_up_ref->name, new_name));
+ cl_assert_strequal(another_looked_up_ref->name, new_name);
/* .. the ref is still loose... */
cl_assert(git_reference_is_packed(another_looked_up_ref) == 0);
@@ -89,14 +89,14 @@ void test_refs_rename__packed(void)
/* Now that the reference is renamed... */
cl_git_pass(git_reference_rename(looked_up_ref, brand_new_name, 0));
- cl_assert(!strcmp(looked_up_ref->name, brand_new_name));
+ cl_assert_strequal(looked_up_ref->name, brand_new_name);
/* ...It can't be looked-up with the old name... */
cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, packed_head_name));
/* ...but the new name works ok... */
cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, brand_new_name));
- cl_assert(!strcmp(another_looked_up_ref->name, brand_new_name));
+ cl_assert_strequal(another_looked_up_ref->name, brand_new_name);
/* .. the ref is no longer packed... */
cl_assert(git_reference_is_packed(another_looked_up_ref) == 0);
@@ -166,7 +166,7 @@ void test_refs_rename__name_collision(void)
/* Failure to rename it hasn't corrupted its state */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
- cl_assert(!strcmp(looked_up_ref->name, packed_head_name));
+ cl_assert_strequal(looked_up_ref->name, packed_head_name);
git_reference_free(looked_up_ref);
}
@@ -188,7 +188,7 @@ void test_refs_rename__invalid_name(void)
/* Failure to rename it hasn't corrupted its state */
git_reference_free(looked_up_ref);
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
- cl_assert(!strcmp(looked_up_ref->name, packed_test_head_name));
+ cl_assert_strequal(looked_up_ref->name, packed_test_head_name);
git_reference_free(looked_up_ref);
}
@@ -209,7 +209,7 @@ void test_refs_rename__force_loose_packed(void)
/* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
- cl_assert(!strcmp(looked_up_ref->name, packed_test_head_name));
+ cl_assert_strequal(looked_up_ref->name, packed_test_head_name);
cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref)));
git_reference_free(looked_up_ref);
@@ -233,7 +233,7 @@ void test_refs_rename__force_loose(void)
/* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/test"));
- cl_assert(!strcmp(looked_up_ref->name, "refs/heads/test"));
+ cl_assert_strequal(looked_up_ref->name, "refs/heads/test");
cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref)));
git_reference_free(looked_up_ref);
@@ -298,7 +298,7 @@ void test_refs_rename__prefix(void)
/* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
- cl_assert(!strcmp(looked_up_ref->name, ref_two_name_new));
+ cl_assert_strequal(looked_up_ref->name, ref_two_name_new);
git_reference_free(looked_up_ref);
cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
@@ -331,7 +331,7 @@ void test_refs_rename__move_up(void)
/* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
- cl_assert(!strcmp(looked_up_ref->name, ref_two_name));
+ cl_assert_strequal(looked_up_ref->name, ref_two_name);
git_reference_free(looked_up_ref);
cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
git_reference_free(ref);
diff --git a/tests-clar/repo/discover.c b/tests-clar/repo/discover.c
index afa3e2d..9d0f083 100644
--- a/tests-clar/repo/discover.c
+++ b/tests-clar/repo/discover.c
@@ -28,7 +28,7 @@ static void ensure_repository_discover(const char *start_path, const char *ceili
char found_path[GIT_PATH_MAX];
cl_git_pass(git_repository_discover(found_path, sizeof(found_path), start_path, 0, ceiling_dirs));
//across_fs is always 0 as we can't automate the filesystem change tests
- cl_assert(0 == strcmp(found_path, expected_path));
+ cl_assert_strequal(found_path, expected_path);
}
static void write_file(const char *path, const char *content)