mirror of
https://github.com/gryf/ADFlib.git
synced 2026-02-13 03:35:47 +01:00
Added regtests
This commit is contained in:
88
regtest/Test/dir_test2.c
Normal file
88
regtest/Test/dir_test2.c
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* dir_test.c
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include"adflib.h"
|
||||
|
||||
|
||||
void MyVer(char *msg)
|
||||
{
|
||||
fprintf(stderr,"Verbose [%s]\n",msg);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct Device *hd;
|
||||
struct Volume *vol;
|
||||
struct List *list, *cell;
|
||||
|
||||
adfEnvInitDefault();
|
||||
|
||||
// adfSetEnvFct(0,0,MyVer,0);
|
||||
|
||||
/* mount existing device */
|
||||
hd = adfMountDev( argv[1],FALSE );
|
||||
if (!hd) {
|
||||
fprintf(stderr, "can't mount device\n");
|
||||
adfEnvCleanUp(); exit(1);
|
||||
}
|
||||
|
||||
vol = adfMount(hd, 0, FALSE);
|
||||
if (!vol) {
|
||||
adfUnMountDev(hd);
|
||||
fprintf(stderr, "can't mount volume\n");
|
||||
adfEnvCleanUp(); exit(1);
|
||||
}
|
||||
|
||||
adfVolumeInfo(vol);
|
||||
|
||||
cell = list = adfGetDirEnt(vol,vol->curDirPtr);
|
||||
while(cell) {
|
||||
printEntry(cell->content);
|
||||
cell = cell->next;
|
||||
}
|
||||
adfFreeDirList(list);
|
||||
|
||||
putchar('\n');
|
||||
|
||||
adfCreateDir(vol,vol->curDirPtr,"dir_1a");
|
||||
|
||||
cell = list = adfGetDirEnt(vol,vol->curDirPtr);
|
||||
while(cell) {
|
||||
printEntry(cell->content);
|
||||
cell = cell->next;
|
||||
}
|
||||
adfFreeDirList(list);
|
||||
|
||||
putchar('\n');
|
||||
|
||||
/* same hash than dir_1a" */
|
||||
adfCreateDir(vol,vol->curDirPtr,"dir_5u");
|
||||
|
||||
cell = list = adfGetDirEnt(vol,vol->curDirPtr);
|
||||
while(cell) {
|
||||
printEntry(cell->content);
|
||||
cell = cell->next;
|
||||
}
|
||||
adfFreeDirList(list);
|
||||
|
||||
putchar('\n');
|
||||
|
||||
adfUnMount(vol);
|
||||
adfUnMountDev(hd);
|
||||
|
||||
|
||||
adfEnvCleanUp();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user