Changeset 13836


Ignore:
Timestamp:
Jan 22, 2013, 5:40:10 AM (8 years ago)
Author:
jordan
Message:

(libT) #1220 'change file and folder names': add unit tests for renaming a root, then branch, then leaf in the torrent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/rename-test.c

    r13835 r13836  
    286286  static const size_t totalSize = 67;
    287287  const tr_file * files;
     288  const char * strings[4];
    288289  const char * expected_files[4] = {
    289290    "Felidae/Felinae/Acinonyx/Cheetah/Chester",
     
    414415
    415416  check_int_eq (0, torrentRenameAndWait (tor, "Felidae", "gabba"));
    416   check_streq ("gabba/Felinae/Acinonyx/Cheetah/Chester",  files[0].name);
    417   check_streq ("gabba/Felinae/Felis/catus/Kyphi",         files[1].name);
    418   check_streq ("gabba/Felinae/Felis/catus/Saffron",       files[2].name);
    419   check_streq ("gabba/Pantherinae/Panthera/Tiger/Tony", files[3].name);
     417  strings[0] = "gabba/Felinae/Acinonyx/Cheetah/Chester";
     418  strings[1] = "gabba/Felinae/Felis/catus/Kyphi";
     419  strings[2] = "gabba/Felinae/Felis/catus/Saffron";
     420  strings[3] = "gabba/Pantherinae/Panthera/Tiger/Tony";
     421  for (i=0; i<4; ++i)
     422    {
     423      check_streq (strings[i], files[i].name);
     424      testFileExistsAndConsistsOfThisString (tor, i, expected_contents[i]);
     425    }
     426
     427  /* rename the root, then a branch, and then a leaf... */
     428  check_int_eq (0, torrentRenameAndWait (tor, "gabba", "Felidae"));
     429  check_int_eq (0, torrentRenameAndWait (tor, "Felidae/Pantherinae/Panthera/Tiger", "Snow Leopard"));
     430  check_int_eq (0, torrentRenameAndWait (tor, "Felidae/Pantherinae/Panthera/Snow Leopard/Tony", "10.6"));
     431  strings[0] = "Felidae/Felinae/Acinonyx/Cheetah/Chester";
     432  strings[1] = "Felidae/Felinae/Felis/catus/Kyphi";
     433  strings[2] = "Felidae/Felinae/Felis/catus/Saffron";
     434  strings[3] = "Felidae/Pantherinae/Panthera/Snow Leopard/10.6";
     435  for (i=0; i<4; ++i)
     436    {
     437      check_streq (strings[i], files[i].name);
     438      testFileExistsAndConsistsOfThisString (tor, i, expected_contents[i]);
     439    }
    420440
    421441  /***
Note: See TracChangeset for help on using the changeset viewer.