/* efstest.c - some basic tests Copyright (C) 2000 Maurer IT Systemlösungen KEG The Gnome Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The Gnome Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the Gnome Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Author: Dietmar Maurer */ #include #include #include #include "efs.h" /*#define TESTSIZE ((512/4)*(16+127+127*127+127*127*2))*/ #define TESTSIZE (1024*1) #define SR(x) { show_result(x); g_assert_not_reached (); } EFSResult result; static void show_result (const gchar *what) { printf ("%s: %s (%d)\n", what, efs_strerror (result), result); } int main () { EFSDir *root,*dir1,*dir2; EFSFile *file; EFSStat filestat; EFSFSStat fsstat; gint32 i,j,size; guint32 code; gchar *p; struct stat fs; gchar buf[1024]; gint32 br; guint32 pos; unlink ("/tmp/test.efs"); /******************************************************************* * Tests for normal files ******************************************************************/ printf ("basic read/write tests:\n"); if ((result = efs_open (&root, "ib1enc:/tmp/test.efs", EFS_CREATE|EFS_PROT, 0664, "test"))) SR ("open failed"); /* try to open non existent file */ if (!(result = efs_file_open (&file, root, "test1.txt", EFS_RDWR))) SR ("open file succeded"); /* create a new file */ if ((result = efs_file_open (&file, root, "test5.txt", EFS_CREATE|EFS_RDWR))) SR ("open file failed"); /* create a new file */ if ((result = efs_file_open (&file, root, "test1.txt", EFS_CREATE|EFS_RDWR))) SR ("open file failed"); for (i=0;i