/npk/cli/tests/npk_07_sort.cpp

http://npk.googlecode.com/ · C++ · 28 lines · 22 code · 6 blank · 0 comment · 2 complexity · 5e8569a5b45b892b895adf7db18e286b MD5 · raw file

  1. #include "testutil.h"
  2. #include <npk.h>
  3. #include <npk_dev.h>
  4. int npk_07_sort( int argc, char * argv [] )
  5. {
  6. CMD( "../npk test.npk -create -add sample.txt@02.jpg sample.txt@01_thumb.jpg sample.txt@02_thumb.jpg sample.txt@01.jpg sample.txt@test.xml --f --k 1:2:3:4" );
  7. CMD( "../npk test.npk -sort *.xml *_thumb.*@DESC --v --k 1:2:3:4" );
  8. int teakey[4] = {1,2,3,4};
  9. NPK_PACKAGE pack = npk_package_open( "test.npk", teakey );
  10. CHECK( pack != NULL );
  11. NPK_ENTITYBODY* eb = (NPK_ENTITYBODY*)npk_package_get_first_entity( pack );
  12. std::string entityNames[5] = { "test.xml", "02_thumb.jpg", "01_thumb.jpg", "01.jpg", "02.jpg" };
  13. int i = 0;
  14. while( eb )
  15. {
  16. CHECK_EQUAL_STR( entityNames[i].c_str(), eb->name_ );
  17. eb = eb->next_;
  18. ++i;
  19. }
  20. npk_package_close( pack );
  21. return 0;
  22. }