PageRenderTime 17ms CodeModel.GetById 9ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/npk/cli/tests/npk_07_sort.cpp

http://npk.googlecode.com/
C++ | 28 lines | 22 code | 6 blank | 0 comment | 1 complexity | 5e8569a5b45b892b895adf7db18e286b MD5 | raw file
 1#include "testutil.h"
 2#include <npk.h>
 3#include <npk_dev.h>
 4
 5int npk_07_sort( int argc, char * argv [] )
 6{
 7    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" );
 8    CMD( "../npk test.npk -sort *.xml *_thumb.*@DESC --v --k 1:2:3:4" );
 9
10    int teakey[4] = {1,2,3,4};
11    NPK_PACKAGE pack = npk_package_open( "test.npk", teakey );
12
13    CHECK( pack != NULL );
14
15    NPK_ENTITYBODY* eb = (NPK_ENTITYBODY*)npk_package_get_first_entity( pack );
16    std::string entityNames[5] = { "test.xml", "02_thumb.jpg", "01_thumb.jpg", "01.jpg", "02.jpg" };
17
18    int i = 0;
19    while( eb )
20    {
21        CHECK_EQUAL_STR( entityNames[i].c_str(), eb->name_ );
22        eb = eb->next_;
23        ++i;
24    }
25    npk_package_close( pack );
26
27    return 0;
28}