-#ifndef _TEST_C_\r
-#define _TEST_C_\r
-\r
-\r
/*\r
- * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded\r
+ * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded\r
*\r
- * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license \r
+ * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license\r
* terms.\r
- * \r
- * FreeRTOS+FAT SL uses a dual license model that allows the software to be used \r
- * under a standard GPL open source license, or a commercial license. The \r
- * standard GPL license (unlike the modified GPL license under which FreeRTOS \r
- * itself is distributed) requires that all software statically linked with \r
- * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms. \r
+ *\r
+ * FreeRTOS+FAT SL uses a dual license model that allows the software to be used\r
+ * under a standard GPL open source license, or a commercial license. The\r
+ * standard GPL license (unlike the modified GPL license under which FreeRTOS\r
+ * itself is distributed) requires that all software statically linked with\r
+ * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms.\r
* Details of both license options follow:\r
- * \r
+ *\r
* - Open source licensing -\r
* FreeRTOS+FAT SL is a free download and may be used, modified, evaluated and\r
- * distributed without charge provided the user adheres to version two of the \r
- * GNU General Public License (GPL) and does not remove the copyright notice or \r
+ * distributed without charge provided the user adheres to version two of the\r
+ * GNU General Public License (GPL) and does not remove the copyright notice or\r
* this text. The GPL V2 text is available on the gnu.org web site, and on the\r
* following URL: http://www.FreeRTOS.org/gpl-2.0.txt.\r
- * \r
+ *\r
* - Commercial licensing -\r
* Businesses and individuals who for commercial or other reasons cannot comply\r
- * with the terms of the GPL V2 license must obtain a commercial license before \r
- * incorporating FreeRTOS+FAT SL into proprietary software for distribution in \r
- * any form. Commercial licenses can be purchased from \r
- * http://shop.freertos.org/fat_sl and do not require any source files to be \r
+ * with the terms of the GPL V2 license must obtain a commercial license before\r
+ * incorporating FreeRTOS+FAT SL into proprietary software for distribution in\r
+ * any form. Commercial licenses can be purchased from\r
+ * http://shop.freertos.org/fat_sl and do not require any source files to be\r
* changed.\r
*\r
* FreeRTOS+FAT SL is distributed in the hope that it will be useful. You\r
\r
#include "test.h"\r
#include "../../api/fat_sl.h"\r
+#include "config_fat_sl_test.h"\r
#include "../../psp/target/fat_sl/psp_test.h"\r
\r
#include "../../version/ver_fat_sl.h"\r
-#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2\r
+#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2\r
#error Incompatible FAT_SL version number!\r
#endif\r
\r
ret = f_format( F_FAT_TYPE );\r
if ( ret )\r
{\r
- return _f_result( 0, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = _f_poweron();\r
if ( ret )\r
{\r
- return _f_result( 1, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "*.*", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 2, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
_f_dump( "passed..." );\r
ret = f_mkdir( "a" );\r
if ( ret )\r
{\r
- return _f_result( 1, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_mkdir( "ab" );\r
if ( ret )\r
{\r
- return _f_result( 2, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_mkdir( "abc" );\r
if ( ret )\r
{\r
- return _f_result( 3, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_mkdir( "abca" );\r
if ( ret )\r
{\r
- return _f_result( 4, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*creates directories in /a - a ab abc abcd*/\r
ret = f_mkdir( "a/a" );\r
if ( ret )\r
{\r
- return _f_result( 5, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_mkdir( "a/ab" );\r
if ( ret )\r
{\r
- return _f_result( 6, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_mkdir( "a/abc" );\r
if ( ret )\r
{\r
- return _f_result( 7, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_mkdir( "a/abcd" );\r
if ( ret )\r
{\r
- return _f_result( 8, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*change into a/abcd and check cwd*/\r
ret = f_chdir( "a/abcd" );\r
if ( ret )\r
{\r
- return _f_result( 9, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = _f_checkcwd( f_nameconv( "/a/abcd" ) );\r
if ( ret )\r
{\r
- return _f_result( 10, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*make directory t change into t and check cwd="a/abcd/t"*/\r
ret = f_mkdir( "t" );\r
if ( ret )\r
{\r
- return _f_result( 11, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( "t" );\r
if ( ret )\r
{\r
- return _f_result( 12, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = _f_checkcwd( f_nameconv( "/a/abcd/t" ) );\r
if ( ret )\r
{\r
- return _f_result( 13, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( "." );\r
if ( ret )\r
{\r
- return _f_result( 14, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = _f_checkcwd( f_nameconv( "/a/abcd/t" ) );\r
if ( ret )\r
{\r
- return _f_result( 15, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( "../." );\r
if ( ret )\r
{\r
- return _f_result( 16, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = _f_checkcwd( f_nameconv( "/a/abcd" ) );\r
if ( ret )\r
{\r
- return _f_result( 17, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*removing t dir*/\r
ret = f_rmdir( "t" );\r
if ( ret )\r
{\r
- return _f_result( 18, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( "t" );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 19, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*removing /a dir*/\r
ret = f_rmdir( "/ab" );\r
if ( ret )\r
{\r
- return _f_result( 20, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( "/ab" );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 21, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*removing /a dir*/\r
ret = f_rmdir( "../../a" );\r
if ( ret != F_ERR_NOTEMPTY )\r
{\r
- return _f_result( 22, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*removing /abca dir*/\r
ret = f_rmdir( "a:/abca" );\r
if ( ret )\r
{\r
- return _f_result( 24, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*changing invalid dirs*/\r
ret = f_chdir( "" );\r
if ( ret != F_ERR_INVALIDNAME )\r
{\r
- return _f_result( 25, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( " " );\r
if ( ret )\r
{\r
- return _f_result( 26, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = _f_checkcwd( f_nameconv( "/a/abcd" ) );\r
if ( ret )\r
{\r
- return _f_result( 27, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( "?" );\r
if ( ret != F_ERR_INVALIDNAME )\r
{\r
- return _f_result( 28, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( "*.*" );\r
if ( ret != F_ERR_INVALIDNAME )\r
{\r
- return _f_result( 29, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = _f_checkcwd( f_nameconv( "/a/abcd" ) );\r
if ( ret )\r
{\r
- return _f_result( 30, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*changing into /abc and removes subfolder from /a/ */\r
ret = f_chdir( "/abc" );\r
if ( ret )\r
{\r
- return _f_result( 31, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_rmdir( "/a/a" );\r
if ( ret )\r
{\r
- return _f_result( 32, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_rmdir( "A:../a/ab" );\r
if ( ret )\r
{\r
- return _f_result( 33, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_rmdir( "A:/a/abc" );\r
if ( ret )\r
{\r
- return _f_result( 34, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_rmdir( ".././abc/.././a/../a/abcd" );\r
if ( ret )\r
{\r
- return _f_result( 35, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*some invalid rmdir*/\r
ret = f_rmdir( "." );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 36, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_rmdir( ".." );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 37, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*create again abc remove abc*/\r
ret = f_mkdir( ".././abc" );\r
if ( ret != F_ERR_DUPLICATED )\r
{\r
- return _f_result( 38, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_rmdir( "../abc" );\r
if ( ret )\r
{\r
- return _f_result( 39, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_mkdir( ".././abc" );\r
if ( ret != F_ERR_INVALIDDIR )\r
{\r
- return _f_result( 40, ret ); /*cwd is not exist*/\r
+ return _f_result( __LINE__, ret ); /*cwd is not exist*/\r
}\r
\r
ret = f_chdir( "/" );\r
if ( ret )\r
{\r
- return _f_result( 41, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*try . and .. in the root*/\r
ret = f_chdir( "." );\r
if ( ret )\r
{\r
- return _f_result( 42, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( "./././." );\r
if ( ret )\r
{\r
- return _f_result( 43, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( ".." );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 44, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = _f_checkcwd( "/" ); /*root!*/\r
if ( ret )\r
{\r
- return _f_result( 45, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*test . and .. in a and remove a*/\r
ret = f_chdir( "a" );\r
if ( ret )\r
{\r
- return _f_result( 46, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( ".." );\r
if ( ret )\r
{\r
- return _f_result( 47, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( "a" );\r
if ( ret )\r
{\r
- return _f_result( 48, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( "." );\r
if ( ret )\r
{\r
- return _f_result( 49, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( "a" );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 50, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( "./.." );\r
if ( ret )\r
{\r
- return _f_result( 51, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_rmdir( "a" );\r
if ( ret )\r
{\r
- return _f_result( 52, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*check if all are removed*/\r
ret = f_findfirst( "*.*", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 53, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
_f_dump( "passed..." );\r
ret = f_findfirst( "*.*", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 0, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*create Hello.dir*/\r
ret = f_mkdir( "Hello.dir" );\r
if ( ret )\r
{\r
- return _f_result( 1, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*check if it is exist, and only exist*/\r
ret = f_findfirst( "*.*", &find );\r
if ( ret )\r
{\r
- return _f_result( 2, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, f_nameconv( "Hello.dir" ) ) )\r
{\r
- return _f_result( 3, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( find.attr != F_ATTR_DIR )\r
{\r
- return _f_result( 4, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_findnext( &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 5, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*check some not founds*/\r
ret = f_findfirst( "q*.*", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 6, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "Hello.", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 7, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "a/*.*", &find );\r
if ( ret != F_ERR_INVALIDDIR )\r
{\r
- return _f_result( 8, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( ".", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 9, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "..", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 10, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "?e.*", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 11, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "*.", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 12, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "*.?", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 13, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "*.??", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 14, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
\r
ret = f_findfirst( "*.dir", &find );\r
if ( ret )\r
{\r
- return _f_result( 15, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "*.d?r", &find );\r
if ( ret )\r
{\r
- return _f_result( 16, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "*.d??", &find );\r
if ( ret )\r
{\r
- return _f_result( 17, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "*.???", &find );\r
if ( ret )\r
{\r
- return _f_result( 18, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "?ello.???", &find );\r
if ( ret )\r
{\r
- return _f_result( 19, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "he??o.dir", &find );\r
if ( ret )\r
{\r
- return _f_result( 20, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "he?*.dir", &find );\r
if ( ret )\r
{\r
- return _f_result( 21, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "HELLO.DIR", &find ); /*no capitals sensitivity in find!!*/\r
if ( ret )\r
{\r
- return _f_result( 22, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*change into hello.dir*/\r
ret = f_chdir( "hello.dir" );\r
if ( ret )\r
{\r
- return _f_result( 23, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "*.*", &find );\r
if ( ret )\r
{\r
- return _f_result( 24, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "..", &find );\r
if ( ret )\r
{\r
- return _f_result( 25, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "??", &find );\r
if ( ret )\r
{\r
- return _f_result( 26, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( ".", &find );\r
if ( ret )\r
{\r
- return _f_result( 27, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "k*.*", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 28, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "*.", &find );\r
if ( ret )\r
{\r
- return _f_result( 29, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, "." ) )\r
{\r
- return _f_result( 29, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_findnext( &find );\r
if ( ret )\r
{\r
- return _f_result( 29, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, ".." ) )\r
{\r
- return _f_result( 29, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_findnext( &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 29, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
\r
ret = f_findfirst( "*.a", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 30, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*creating testdir and find it*/\r
ret = f_mkdir( "testdir" );\r
if ( ret )\r
{\r
- return _f_result( 31, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "*.", &find );\r
if ( ret )\r
{\r
- return _f_result( 32, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, "." ) )\r
{\r
- return _f_result( 32, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_findnext( &find );\r
if ( ret )\r
{\r
- return _f_result( 32, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, ".." ) )\r
{\r
- return _f_result( 32, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_findnext( &find );\r
if ( ret )\r
{\r
- return _f_result( 32, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
\r
if ( strcmp( find.filename, f_nameconv( "testdir" ) ) )\r
{\r
- return _f_result( 33, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_findfirst( "*.*", &find );\r
if ( ret )\r
{\r
- return _f_result( 34, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, "." ) )\r
{\r
- return _f_result( 35, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_findnext( &find );\r
if ( ret )\r
{\r
- return _f_result( 35, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, ".." ) )\r
{\r
- return _f_result( 35, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_findnext( &find );\r
if ( ret )\r
{\r
- return _f_result( 36, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, f_nameconv( "testdir" ) ) )\r
{\r
- return _f_result( 37, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_findnext( &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 38, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*search exact file*/\r
ret = f_findfirst( "testDir", &find ); /*no capitals!*/\r
if ( ret )\r
{\r
- return _f_result( 39, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, f_nameconv( "testdir" ) ) )\r
{\r
- return _f_result( 40, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_findnext( &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 41, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
\r
ret = f_chdir( "\\" );\r
if ( ret )\r
{\r
- return _f_result( 42, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_rmdir( "Hello.dir/testdir" );\r
if ( ret )\r
{\r
- return _f_result( 43, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_rmdir( "Hello.dir" );\r
if ( ret )\r
{\r
- return _f_result( 44, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*check if all are removed*/\r
ret = f_findfirst( "*.*", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 45, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
_f_dump( "passed..." );\r
ret = f_mkdir( "testdir" );\r
if ( ret )\r
{\r
- return _f_result( 0, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = _f_poweron();\r
if ( ret )\r
{\r
- return _f_result( 1, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "testdir", &find );\r
if ( ret )\r
{\r
- return _f_result( 2, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*checking formatting*/\r
ret = f_format( F_FAT_TYPE );\r
if ( ret )\r
{\r
- return _f_result( 3, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = _f_poweron();\r
if ( ret )\r
{\r
- return _f_result( 4, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "*.*", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 5, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*checking formatting, 1st creating*/\r
ret = f_format( F_FAT_TYPE );\r
if ( ret )\r
{\r
- return _f_result( 6, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_mkdir( "testdir" );\r
if ( ret )\r
{\r
- return _f_result( 7, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "testdir", &find );\r
if ( ret )\r
{\r
- return _f_result( 8, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, f_nameconv( "testdir" ) ) )\r
{\r
- return _f_result( 9, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = _f_poweron();\r
if ( ret )\r
{\r
- return _f_result( 10, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "*.*", &find );\r
if ( ret )\r
{\r
- return _f_result( 11, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, f_nameconv( "testdir" ) ) )\r
{\r
- return _f_result( 12, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
/*checking formatting, 2nd creating*/\r
ret = f_format( F_FAT_TYPE );\r
if ( ret )\r
{\r
- return _f_result( 13, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_mkdir( "testdir" );\r
if ( ret )\r
{\r
- return _f_result( 14, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "testdir", &find );\r
if ( ret )\r
{\r
- return _f_result( 15, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, f_nameconv( "testdir" ) ) )\r
{\r
- return _f_result( 16, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_mkdir( "testdir2" );\r
if ( ret )\r
{\r
- return _f_result( 17, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "testdir2", &find );\r
if ( ret )\r
{\r
- return _f_result( 18, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, f_nameconv( "testdir2" ) ) )\r
{\r
- return _f_result( 19, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = _f_poweron();\r
if ( ret )\r
{\r
- return _f_result( 20, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "*.*", &find );\r
if ( ret )\r
{\r
- return _f_result( 21, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, f_nameconv( "testdir" ) ) )\r
{\r
- return _f_result( 22, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_findnext( &find );\r
if ( ret )\r
{\r
- return _f_result( 23, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( strcmp( find.filename, f_nameconv( "testdir2" ) ) )\r
{\r
- return _f_result( 24, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_findnext( &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 25, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
\r
ret = _f_poweron();\r
if ( ret )\r
{\r
- return _f_result( 26, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_format( F_FAT_TYPE );\r
if ( ret )\r
{\r
- return _f_result( 27, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = _f_poweron();\r
if ( ret )\r
{\r
- return _f_result( 28, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_findfirst( "*.*", &find );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 29, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
\r
unsigned char ret;\r
unsigned long size;\r
unsigned long pos;\r
+ unsigned long fname_pos;\r
+ char * test_fname[4] =\r
+ {\r
+ "test1.txt", "test2.txt", "test3.txt", "test4.txt"\r
+ };\r
\r
if ( sectorsize == 128 )\r
{\r
_f_dump( "f_seeking with 128" );\r
}\r
\r
- #if ( F_MAX_SEEK_TEST > 128 )\r
+#if ( F_MAX_SEEK_TEST > 128 )\r
else if ( sectorsize == 256 )\r
{\r
_f_dump( "f_seeking with 256" );\r
}\r
- #endif\r
- #if ( F_MAX_SEEK_TEST > 256 )\r
+#endif\r
+#if ( F_MAX_SEEK_TEST > 256 )\r
else if ( sectorsize == 512 )\r
{\r
_f_dump( "f_seeking with 512" );\r
}\r
- #endif\r
- #if ( F_MAX_SEEK_TEST > 512 )\r
+#endif\r
+#if ( F_MAX_SEEK_TEST > 512 )\r
else if ( sectorsize == 1024 )\r
{\r
_f_dump( "f_seeking with 1024" );\r
}\r
- #endif\r
- #if ( F_MAX_SEEK_TEST > 1024 )\r
+#endif\r
+#if ( F_MAX_SEEK_TEST > 1024 )\r
else if ( sectorsize == 2048 )\r
{\r
_f_dump( "f_seeking with 2048" );\r
}\r
- #endif\r
- #if ( F_MAX_SEEK_TEST > 2048 )\r
+#endif\r
+#if ( F_MAX_SEEK_TEST > 2048 )\r
else if ( sectorsize == 4096 )\r
{\r
_f_dump( "f_seeking with 4096" );\r
}\r
- #endif\r
- #if ( F_MAX_SEEK_TEST > 4096 )\r
+#endif\r
+#if ( F_MAX_SEEK_TEST > 4096 )\r
else if ( sectorsize == 8192 )\r
{\r
_f_dump( "f_seeking with 8192" );\r
}\r
- #endif\r
- #if ( F_MAX_SEEK_TEST > 8192 )\r
+#endif\r
+#if ( F_MAX_SEEK_TEST > 8192 )\r
else if ( sectorsize == 16384 )\r
{\r
_f_dump( "f_seeking with 16384" );\r
}\r
- #endif\r
- #if ( F_MAX_SEEK_TEST > 16384 )\r
+#endif\r
+#if ( F_MAX_SEEK_TEST > 16384 )\r
else if ( sectorsize == 32768 )\r
{\r
_f_dump( "f_seeking with 32768" );\r
}\r
- #endif\r
+#endif\r
else\r
{\r
_f_dump( "f_seeking with random" );\r
file = f_open( "test.bin", "w+" );\r
if ( !file )\r
{\r
- return _f_result( 0, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
/*write sectorsize times 0*/\r
psp_memset( testbuffer, 0, sectorsize );\r
size = (unsigned long)f_write( testbuffer, 1, (long)sectorsize, file );\r
- if ( size != (unsigned long) sectorsize )\r
+ if ( size != (unsigned long)sectorsize )\r
{\r
- return _f_result( 1, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) sectorsize )\r
+ if ( pos != (unsigned long)sectorsize )\r
{\r
- return _f_result( 2, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*seek back and read some*/\r
ret = f_seek( file, 0, F_SEEK_SET ); /*seek back*/\r
if ( ret )\r
{\r
- return _f_result( 3, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
if ( pos )\r
{\r
- return _f_result( 4, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
size = (unsigned long)f_read( testbuffer, 1, sectorsize, file );\r
- if ( size != (unsigned long) sectorsize )\r
+ if ( size != (unsigned long)sectorsize )\r
{\r
- return _f_result( 5, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) sectorsize )\r
+ if ( pos != (unsigned long)sectorsize )\r
{\r
- return _f_result( 6, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*fake read at eof*/\r
size = (unsigned long)f_read( testbuffer, 1, 2, file ); /*eof!*/\r
if ( size != 0 )\r
{\r
- return _f_result( 7, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) sectorsize )\r
+ if ( pos != (unsigned long)sectorsize )\r
{\r
- return _f_result( 8, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*writing sectorsize times 1 at the end*/\r
psp_memset( testbuffer, 1, sectorsize );\r
size = (unsigned long)f_write( testbuffer, 1, sectorsize, file );\r
- if ( size != (unsigned long) sectorsize )\r
+ if ( size != (unsigned long)sectorsize )\r
{\r
- return _f_result( 11, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) ( sectorsize * 2 ) )\r
+ if ( pos != (unsigned long)( sectorsize * 2 ) )\r
{\r
- return _f_result( 12, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*seeking back and read 1byte less*/\r
ret = f_seek( file, 0, F_SEEK_SET );\r
if ( ret )\r
{\r
- return _f_result( 13, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
if ( pos )\r
{\r
- return _f_result( 14, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
size = (unsigned long)f_read( testbuffer, 1, sectorsize - 1, file );\r
- if ( size != (unsigned long) ( sectorsize - 1 ) )\r
+ if ( size != (unsigned long)( sectorsize - 1 ) )\r
{\r
- return _f_result( 15, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) ( sectorsize - 1 ) )\r
+ if ( pos != (unsigned long)( sectorsize - 1 ) )\r
{\r
- return _f_result( 16, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
\r
size = (unsigned long)f_write( testbuffer, 1, 2, file );\r
if ( size != 2 )\r
{\r
- return _f_result( 17, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) ( sectorsize + 1 ) )\r
+ if ( pos != (unsigned long)( sectorsize + 1 ) )\r
{\r
- return _f_result( 18, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*read 2 bytes*/\r
size = (unsigned long)f_read( testbuffer, 2, 1, file );\r
if ( size != 1 )\r
{\r
- return _f_result( 19, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) ( sectorsize + 3 ) )\r
+ if ( pos != (unsigned long)( sectorsize + 3 ) )\r
{\r
- return _f_result( 20, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
\r
size = (unsigned long)f_write( testbuffer, 1, 4, file );\r
if ( size != 4 )\r
{\r
- return _f_result( 21, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) ( sectorsize + 3 + 4 ) )\r
+ if ( pos != (unsigned long)( sectorsize + 3 + 4 ) )\r
{\r
- return _f_result( 22, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*seek at 2*/\r
ret = f_seek( file, 2, F_SEEK_SET );\r
if ( ret )\r
{\r
- return _f_result( 23, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
if ( pos != 2 )\r
{\r
- return _f_result( 24, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*write 6 times 4*/\r
size = (unsigned long)f_write( testbuffer, 1, 6, file );\r
if ( size != 6 )\r
{\r
- return _f_result( 25, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
if ( pos != 8 )\r
{\r
- return _f_result( 26, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*seek end -4*/\r
ret = f_seek( file, -4, F_SEEK_END );\r
if ( ret )\r
{\r
- return _f_result( 27, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) ( 2 * sectorsize - 4 ) )\r
+ if ( pos != (unsigned long)( 2 * sectorsize - 4 ) )\r
{\r
- return _f_result( 28, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*read 2 bytes*/\r
size = (unsigned long)f_read( testbuffer, 1, 2, file );\r
if ( size != 2 )\r
{\r
- return _f_result( 29, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) ( 2 * sectorsize - 2 ) )\r
+ if ( pos != (unsigned long)( 2 * sectorsize - 2 ) )\r
{\r
- return _f_result( 30, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*write 8 times 5*/\r
size = (unsigned long)f_write( testbuffer, 1, 8, file );\r
if ( size != 8 )\r
{\r
- return _f_result( 31, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) ( 2 * sectorsize + 6 ) )\r
+ if ( pos != (unsigned long)( 2 * sectorsize + 6 ) )\r
{\r
- return _f_result( 32, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*seek to the begining*/\r
ret = f_seek( file, 0, F_SEEK_SET );\r
if ( ret )\r
{\r
- return _f_result( 33, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
if ( pos )\r
{\r
- return _f_result( 34, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*seek to the end*/\r
ret = f_seek( file, 2 * sectorsize + 6, F_SEEK_SET );\r
if ( ret )\r
{\r
- return _f_result( 35, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) ( 2 * sectorsize + 6 ) )\r
+ if ( pos != (unsigned long)( 2 * sectorsize + 6 ) )\r
{\r
- return _f_result( 36, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*write 2 times 6*/\r
size = (unsigned long)f_write( testbuffer, 1, 2, file );\r
if ( size != 2 )\r
{\r
- return _f_result( 37, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) ( 2 * sectorsize + 8 ) )\r
+ if ( pos != (unsigned long)( 2 * sectorsize + 8 ) )\r
{\r
- return _f_result( 38, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*seek to the begining*/\r
(void)f_seek( file, -( 2 * sectorsize + 8 ), F_SEEK_CUR );\r
if ( ret )\r
{\r
- return _f_result( 39, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
if ( pos )\r
{\r
- return _f_result( 40, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*read 2 times sector*/\r
size = (unsigned long)f_read( testbuffer, 1, sectorsize, file );\r
- if ( size != (unsigned long) sectorsize )\r
+ if ( size != (unsigned long)sectorsize )\r
{\r
- return _f_result( 41, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) sectorsize )\r
+ if ( pos != (unsigned long)sectorsize )\r
{\r
- return _f_result( 42, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
size = (unsigned long)f_read( testbuffer, 1, sectorsize, file );\r
- if ( size != (unsigned long) sectorsize )\r
+ if ( size != (unsigned long)sectorsize )\r
{\r
- return _f_result( 43, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) ( 2 * sectorsize ) )\r
+ if ( pos != (unsigned long)( 2 * sectorsize ) )\r
{\r
- return _f_result( 44, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*write 1 once 7*/\r
size = (unsigned long)f_write( testbuffer, 1, 1, file );\r
if ( size != 1 )\r
{\r
- return _f_result( 45, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) ( 2 * sectorsize + 1 ) )\r
+ if ( pos != (unsigned long)( 2 * sectorsize + 1 ) )\r
{\r
- return _f_result( 46, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*close it*/\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 47, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
\r
/*check the result*/\r
size = (unsigned long)f_filelength( "test.bin" );\r
- if ( size != (unsigned long) ( 2 * sectorsize + 8 ) )\r
+ if ( size != (unsigned long)( 2 * sectorsize + 8 ) )\r
{\r
- return _f_result( 48, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
/*opens it*/\r
file = f_open( "test.bin", "r" );\r
if ( !file )\r
{\r
- return _f_result( 49, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
if ( checkfilecontent( 2, 0, file ) )\r
{\r
- return _f_result( 50, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( checkfilecontent( 6, 4, file ) )\r
{\r
- return _f_result( 51, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( checkfilecontent( sectorsize - 8 - 1, 0, file ) )\r
{\r
- return _f_result( 52, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( checkfilecontent( 2, 2, file ) )\r
{\r
- return _f_result( 53, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( checkfilecontent( 2, 1, file ) )\r
{\r
- return _f_result( 54, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( checkfilecontent( 4, 3, file ) )\r
{\r
- return _f_result( 55, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( checkfilecontent( sectorsize - 7 - 2, 1, file ) )\r
{\r
- return _f_result( 56, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( checkfilecontent( 2, 5, file ) )\r
{\r
- return _f_result( 57, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( checkfilecontent( 1, 7, file ) )\r
{\r
- return _f_result( 58, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( checkfilecontent( 5, 5, file ) )\r
{\r
- return _f_result( 59, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( checkfilecontent( 2, 6, file ) )\r
{\r
- return _f_result( 60, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
/*check pos result*/\r
pos = (unsigned long)f_tell( file );\r
- if ( pos != (unsigned long) ( 2 * sectorsize + 8 ) )\r
+ if ( pos != (unsigned long)( 2 * sectorsize + 8 ) )\r
{\r
- return _f_result( 61, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*this has to be eof*/\r
pos = f_eof( file );\r
if ( !pos )\r
{\r
- return _f_result( 62, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
/*close it*/\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 63, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
/*deletes it*/\r
ret = f_delete( "test.bin" );\r
if ( ret )\r
{\r
- return _f_result( 64, ret );\r
+ return _f_result( __LINE__, ret );\r
+ }\r
+\r
+ /**************************************************************/\r
+ for ( pos = 0 ; pos < 4 ; pos++ )\r
+ {\r
+ file = f_open( test_fname[pos], "w" );\r
+ if ( file == NULL )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ memset( testbuffer, '0' + pos, sectorsize );\r
+ if ( f_write( testbuffer, 1, sectorsize - 1, file ) != ( sectorsize - 1 ) )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_close( file );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+ }\r
+\r
+ ret = f_delete( test_fname[0] );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, ret );\r
+ }\r
+\r
+ ret = f_delete( test_fname[2] );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, ret );\r
+ }\r
+\r
+ file = f_open( "test.txt", "w" );\r
+ if ( file == NULL )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ memset( testbuffer, 'a', sectorsize );\r
+ if ( f_write( testbuffer, 1, sectorsize, file ) != sectorsize )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_close( file );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ file = f_open( "test.txt", "r+" );\r
+ if ( file == NULL )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_seek( file, 2 * sectorsize, F_SEEK_SET );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, ret );\r
+ }\r
+\r
+ ret = f_close( file );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ for ( pos = 0 ; pos < 2 ; pos++ )\r
+ {\r
+ file = f_open( "test.txt", "r+" );\r
+ if ( file == NULL )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_seek( file, ( pos + 2 ) * sectorsize, F_SEEK_SET );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, ret );\r
+ }\r
+\r
+ memset( testbuffer, 'b' + pos, sectorsize );\r
+ if ( f_write( testbuffer, 1, sectorsize, file ) != sectorsize )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_close( file );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, ret );\r
+ }\r
+ }\r
+\r
+ fname_pos = 1;\r
+ for ( pos = 0 ; pos < 2 ; pos++ )\r
+ {\r
+ file = f_open( test_fname[fname_pos], "r" );\r
+ if ( file == NULL )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ if ( checkfilecontent( sectorsize - 1, '0' + ( unsigned char ) fname_pos, file ) )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_close( file );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, ret );\r
+ }\r
+\r
+ fname_pos = 3;\r
+ }\r
+\r
+ file = f_open( "test.txt", "r" );\r
+ if ( file == NULL )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ if ( checkfilecontent( sectorsize, 'a', file ) )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ if ( checkfilecontent( sectorsize, 0, file ) )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ if ( checkfilecontent( sectorsize, 'b', file ) )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ if ( checkfilecontent( sectorsize, 'c', file ) )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_close( file );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, ret );\r
+ }\r
+\r
+ ret = f_delete( "test.txt" );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, ret );\r
+ }\r
+\r
+ /************************************/\r
+ file = f_open( "test.txt", "w" );\r
+ if ( file == NULL )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_seek( file, sectorsize - 2, F_SEEK_SET );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_close( file );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ file = f_open( "test.txt", "r+" );\r
+ if ( file == NULL )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ memset( testbuffer, 'f', 2 );\r
+ if ( f_write( testbuffer, 1, 2, file ) != 2 )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_seek( file, sectorsize - 2, F_SEEK_SET );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ memset( testbuffer, 'g', 3 );\r
+ if ( f_write( testbuffer, 1, 3, file ) != 3 )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_close( file );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ file = f_open( "test.txt", "r+" );\r
+ if ( file == NULL )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_seek( file, sectorsize * 2, F_SEEK_SET );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ memset( testbuffer, 'h', sectorsize );\r
+ if ( f_write( testbuffer, 1, sectorsize, file ) != sectorsize )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_close( file );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ size = f_filelength( "test.txt" );\r
+ if ( size != ( unsigned long ) ( 3 * sectorsize ) )\r
+ {\r
+ return _f_result( __LINE__, size );\r
+ }\r
+\r
+ fname_pos = 1;\r
+ for ( pos = 0 ; pos < 2 ; pos++ )\r
+ {\r
+ file = f_open( test_fname[fname_pos], "r" );\r
+ if ( file == NULL )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ if ( checkfilecontent( sectorsize - 1, '0' + ( unsigned char ) fname_pos, file ) )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_close( file );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, ret );\r
+ }\r
+\r
+ fname_pos = 3;\r
+ }\r
+\r
+ file = f_open( "test.txt", "r" );\r
+ if ( file == NULL )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ if ( checkfilecontent( 2, 'f', file ) )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ if ( checkfilecontent( sectorsize - 4, 0, file ) )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ if ( checkfilecontent( 3, 'g', file ) )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ if ( checkfilecontent( sectorsize - 1, 0, file ) )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ if ( checkfilecontent( sectorsize, 'h', file ) )\r
+ {\r
+ return _f_result( __LINE__, 0 );\r
+ }\r
+\r
+ ret = f_close( file );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, ret );\r
+ }\r
+\r
+ ret = f_delete( "test.txt" );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, ret );\r
+ }\r
+\r
+ ret = f_delete( test_fname[1] );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, ret );\r
+ }\r
+\r
+ ret = f_delete( test_fname[3] );\r
+ if ( ret != F_NO_ERROR )\r
+ {\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
_f_dump( "passed..." );\r
file = f_open( "file.bin", "r" );\r
if ( file )\r
{\r
- return _f_result( 0, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
file = f_open( "file.bin", "r+" );\r
if ( file )\r
{\r
- return _f_result( 1, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
/*test non existing appends "a" a+*/\r
file = f_open( "file.bin", "a" );\r
if ( !file )\r
{\r
- return _f_result( 2, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
file2 = f_open( "file.bin", "a+" ); /*open again*/\r
if ( file2 )\r
{\r
- return _f_result( 3, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 3, 1 );\r
+ return _f_result( __LINE__, 1 );\r
}\r
\r
ret = f_close( file2 );\r
if ( ret != F_ERR_NOTOPEN )\r
{\r
- return _f_result( 3, 2 );\r
+ return _f_result( __LINE__, 2 );\r
}\r
\r
\r
file = f_open( "file.bin", "w" );\r
if ( !file )\r
{\r
- return _f_result( 4, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
/*write 512 times 1*/\r
size = (unsigned short)f_write( testbuffer, 1, 512, file ); /*test write*/\r
if ( size != 512 )\r
{\r
- return _f_result( 5, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
/*go back, and read it*/\r
ret = f_rewind( file ); /*back to the begining*/\r
if ( ret )\r
{\r
- return _f_result( 6, ret ); /*it should fail*/\r
+ return _f_result( __LINE__, ret ); /*it should fail*/\r
}\r
\r
size = (unsigned short)f_read( testbuffer, 1, 512, file ); /*test read*/\r
if ( size )\r
{\r
- return _f_result( 7, size ); /*it should fail*/\r
+ return _f_result( __LINE__, size ); /*it should fail*/\r
}\r
\r
/*close and check size*/\r
size = (unsigned short)f_filelength( "file.bin" );\r
if ( size )\r
{\r
- return _f_result( 8, size ); /*has to be zero*/\r
+ return _f_result( __LINE__, size ); /*has to be zero*/\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 9, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
size = (unsigned short)f_filelength( "file.bin" );\r
if ( size != 512 )\r
{\r
- return _f_result( 10, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
/*try to owerwrites it it*/\r
file = f_open( "file.bin", "w+" );\r
if ( !file )\r
{\r
- return _f_result( 11, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
/*close and check size*/\r
size = (unsigned short)f_filelength( "file.bin" );\r
if ( size )\r
{\r
- return _f_result( 12, size ); /*has to be zero*/\r
+ return _f_result( __LINE__, size ); /*has to be zero*/\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 13, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
size = (unsigned short)f_filelength( "file.bin" );\r
if ( size )\r
{\r
- return _f_result( 14, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
\r
file = f_open( "file.bin", "r+" );\r
if ( !file )\r
{\r
- return _f_result( 15, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
/*write 512 times 1*/\r
size = (unsigned short)f_write( testbuffer, 1, 512, file ); /*test write*/\r
if ( size != 512 )\r
{\r
- return _f_result( 16, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
/*go back, and read it*/\r
size = (unsigned short)f_read( testbuffer, 1, 512, file ); /*test read*/\r
if ( size != 512 )\r
{\r
- return _f_result( 17, size ); /*it should fail*/\r
+ return _f_result( __LINE__, size ); /*it should fail*/\r
}\r
\r
ret = f_rewind( file ); /*back to the begining*/\r
size = (unsigned short)f_write( testbuffer, 1, 256, file ); /*test write*/\r
if ( size != 256 )\r
{\r
- return _f_result( 18, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
pos = (unsigned short)f_tell( file );\r
if ( pos != 256 )\r
{\r
- return _f_result( 19, pos ); /*position has to be 512*/\r
+ return _f_result( __LINE__, pos ); /*position has to be 512*/\r
}\r
\r
size = (unsigned short)f_filelength( "file.bin" );\r
if ( size )\r
{\r
- return _f_result( 20, size ); /*has to be zero*/\r
+ return _f_result( __LINE__, size ); /*has to be zero*/\r
}\r
\r
/*close and check size*/\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 21, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
size = (unsigned short)f_filelength( "file.bin" );\r
if ( size != 512 )\r
{\r
- return _f_result( 22, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
\r
file = f_open( "file.bin", "a+" );\r
if ( !file )\r
{\r
- return _f_result( 23, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
pos = (unsigned short)f_tell( file );\r
if ( pos != 512 )\r
{\r
- return _f_result( 24, pos ); /*position has to be 512*/\r
+ return _f_result( __LINE__, pos ); /*position has to be 512*/\r
}\r
\r
/*write 512 times 3*/\r
size = (unsigned short)f_write( testbuffer, 1, 512, file ); /*test write*/\r
if ( size != 512 )\r
{\r
- return _f_result( 25, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
/*go back, and read it*/\r
ret = f_rewind( file ); /*back to the begining*/\r
if ( ret )\r
{\r
- return _f_result( 26, ret ); /*it should fail*/\r
+ return _f_result( __LINE__, ret ); /*it should fail*/\r
}\r
\r
size = (unsigned short)f_read( testbuffer, 1, 512, file ); /*test read*/\r
if ( size != 512 )\r
{\r
- return _f_result( 27, size ); /*it should fail*/\r
+ return _f_result( __LINE__, size ); /*it should fail*/\r
}\r
\r
pos = (unsigned short)f_tell( file );\r
if ( pos != 512 )\r
{\r
- return _f_result( 28, pos ); /*position has to be 512*/\r
+ return _f_result( __LINE__, pos ); /*position has to be 512*/\r
}\r
\r
/*close and check size*/\r
size = (unsigned short)f_filelength( "file.bin" );\r
if ( size != 512 )\r
{\r
- return _f_result( 29, size ); /*has to be zero*/\r
+ return _f_result( __LINE__, size ); /*has to be zero*/\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 30, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
size = (unsigned short)f_filelength( "file.bin" );\r
if ( size != 1024 )\r
{\r
- return _f_result( 31, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
/*close again!*/\r
ret = f_close( file );\r
if ( ret != F_ERR_NOTOPEN )\r
{\r
- return _f_result( 32, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
ret = f_delete( "file.bin" );\r
if ( ret )\r
{\r
- return _f_result( 33, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
_f_dump( "passed..." );\r
file = f_open( "ap.bin", "a" );\r
if ( !file )\r
{\r
- return _f_result( 1, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
psp_memset( testbuffer, a, sizeof( testbuffer ) );\r
size = (unsigned short)f_write( testbuffer, 1, a + 128, file );\r
if ( size != a + 128 )\r
{\r
- return _f_result( 2, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
size = (unsigned short)f_filelength( "ap.bin" );\r
if ( size != tsize )\r
{\r
- return _f_result( 3, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
tsize += a + 128;\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 4, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
size = (unsigned short)f_filelength( "ap.bin" );\r
if ( size != tsize )\r
{\r
- return _f_result( 5, size );\r
+ return _f_result( __LINE__, size );\r
}\r
}\r
\r
file = f_open( "ap.bin", "r" );\r
if ( !file )\r
{\r
- return _f_result( 6, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
for ( tsize = 0, a = 0 ; a < 16 ; a++ )\r
{\r
if ( checkfilecontent( a + 128, (char)a, file ) )\r
{\r
- return _f_result( 7, a );\r
+ return _f_result( __LINE__, a );\r
}\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 8, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
for ( tsize = 0, a = 0 ; a < 16 ; a++ )\r
file = f_open( "ap.bin", "r" );\r
if ( !file )\r
{\r
- return _f_result( 9, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_seek( file, tsize, F_SEEK_SET );\r
if ( ret )\r
{\r
- return _f_result( 10, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
pos = (unsigned short)f_tell( file );\r
if ( pos != tsize )\r
{\r
- return _f_result( 11, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
size = (unsigned short)f_read( testbuffer, 1, a + 128, file );\r
if ( size != a + 128 )\r
{\r
- return _f_result( 12, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
for ( b = 0 ; b < a + 128 ; b++ )\r
{\r
if ( testbuffer[b] != (char)a )\r
{\r
- return _f_result( 13, a );\r
+ return _f_result( __LINE__, a );\r
}\r
}\r
\r
pos = (unsigned short)f_tell( file );\r
if ( pos != tsize )\r
{\r
- return _f_result( 13, pos );\r
+ return _f_result( __LINE__, pos );\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 14, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
}\r
\r
ret = f_close( file );\r
if ( ret != F_ERR_NOTOPEN )\r
{\r
- return _f_result( 9, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_delete( "ap.bin" );\r
if ( ret )\r
{\r
- return _f_result( 14, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
_f_dump( "passed..." );\r
ret = f_getfreespace( &before );\r
if ( ret )\r
{\r
- return _f_result( 0, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
for ( a = 0 ; a < 4 ; a++ )\r
file = f_open( "wr.bin", "w" );\r
if ( !file )\r
{\r
- return _f_result( 1, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
psp_memset( testbuffer, a, sizeof( testbuffer ) );\r
size = (unsigned short)f_write( testbuffer, 1, a * 128, file );\r
if ( size != a * 128 )\r
{\r
- return _f_result( 2, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 3, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
size = (unsigned short)f_filelength( "wr.bin" );\r
if ( size != a * 128 )\r
{\r
- return _f_result( 4, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
file = f_open( "wr.bin", "r" );\r
if ( !file )\r
{\r
- return _f_result( 5, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( checkfilecontent( a * 128, (char)a, file ) )\r
{\r
- return _f_result( 6, a );\r
+ return _f_result( __LINE__, a );\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 7, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
}\r
\r
file = f_open( "wr.bin", "w+" );\r
if ( !file )\r
{\r
- return _f_result( 8, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
psp_memset( testbuffer, a, sizeof( testbuffer ) );\r
size = (unsigned short)f_write( testbuffer, 1, a * 128, file );\r
if ( size != a * 128 )\r
{\r
- return _f_result( 9, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 10, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
size = (unsigned short)f_filelength( "wr.bin" );\r
if ( size != a * 128 )\r
{\r
- return _f_result( 11, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
file = f_open( "wr.bin", "r+" );\r
if ( !file )\r
{\r
- return _f_result( 12, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( checkfilecontent( a * 128, (char)a, file ) )\r
{\r
- return _f_result( 13, a );\r
+ return _f_result( __LINE__, a );\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 14, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
}\r
\r
ret = f_getfreespace( &after );\r
if ( ret )\r
{\r
- return _f_result( 15, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( before.bad != after.bad )\r
{\r
- return _f_result( 16, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( before.free == after.free )\r
{\r
- return _f_result( 17, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( before.used == after.used )\r
{\r
- return _f_result( 18, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( before.total != after.total )\r
{\r
- return _f_result( 19, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( before.used + before.free != after.used + after.free )\r
{\r
- return _f_result( 20, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_delete( "wr.bin" );\r
if ( ret )\r
{\r
- return _f_result( 21, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_getfreespace( &after );\r
if ( ret )\r
{\r
- return _f_result( 22, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
if ( before.bad != after.bad )\r
{\r
- return _f_result( 23, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( before.free != after.free )\r
{\r
- return _f_result( 24, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( before.used != after.used )\r
{\r
- return _f_result( 25, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
if ( before.total != after.total )\r
{\r
- return _f_result( 26, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
_f_dump( "passed..." );\r
ret = f_mkdir( "/tt" );\r
if ( ret )\r
{\r
- return _f_result( 0, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( "/tt" );\r
if ( ret )\r
{\r
- return _f_result( 1, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_rmdir( "." );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 4, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_rmdir( ".." );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 5, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( "." );\r
if ( ret )\r
{\r
- return _f_result( 6, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = _f_checkcwd( f_nameconv( "/tt" ) );\r
if ( ret )\r
{\r
- return _f_result( 7, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_delete( "." );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 8, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_delete( ".." );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 9, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_mkdir( "." );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 10, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_mkdir( ".." );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 11, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_mkdir( "..." );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 12, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
for ( a = 0 ; a < 6 ; a++ )\r
break;\r
\r
default:\r
- return _f_result( 13, a );\r
+ return _f_result( __LINE__, a );\r
} /* switch */\r
\r
file = f_open( ".", mode );\r
if ( file )\r
{\r
- return _f_result( 14, a );\r
+ return _f_result( __LINE__, a );\r
}\r
\r
file = f_open( "..", mode );\r
if ( file )\r
{\r
- return _f_result( 15, a );\r
+ return _f_result( __LINE__, a );\r
}\r
\r
file = f_open( "...", mode );\r
if ( file )\r
{\r
- return _f_result( 16, a );\r
+ return _f_result( __LINE__, a );\r
}\r
}\r
\r
size = (unsigned char)f_filelength( "." );\r
if ( size )\r
{\r
- return _f_result( 17, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
size = (unsigned char)f_filelength( ".." );\r
if ( size )\r
{\r
- return _f_result( 18, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
size = (unsigned char)f_filelength( "..." );\r
if ( size )\r
{\r
- return _f_result( 19, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
\r
ret = f_chdir( "..." );\r
if ( ret != F_ERR_NOTFOUND )\r
{\r
- return _f_result( 20, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_chdir( ".." );\r
if ( ret )\r
{\r
- return _f_result( 21, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
ret = f_rmdir( "tt" );\r
if ( ret )\r
{\r
- return _f_result( 27, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
\r
unsigned char Line;\r
unsigned char Buf[87];\r
} struct_TestFileSysEntry;\r
- #define NUM_OF_RECORDS 10\r
+#define NUM_OF_RECORDS 10\r
static unsigned char f_rit ( void )\r
{\r
unsigned char i;\r
File = f_open( "MyTest", "a+" );\r
if ( !File )\r
{\r
- return _f_result( 1, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
/* add records */\r
\r
if ( F_NO_ERROR != f_seek( File, 0, F_SEEK_END ) )\r
{\r
- return _f_result( 2, 0 ); /* Fail, could not go to the end of the file */\r
+ return _f_result( __LINE__, 0 ); /* Fail, could not go to the end of the file */\r
}\r
\r
if ( sizeof( struct_TestFileSysEntry ) != f_write( (void *)Entry, 1, sizeof( struct_TestFileSysEntry ), File ) )\r
{\r
- return _f_result( 3, 0 ); /* Fail, could not write new entry */\r
+ return _f_result( __LINE__, 0 ); /* Fail, could not write new entry */\r
}\r
\r
Pos = (unsigned short)f_tell( File );\r
if ( ( ( Pos / sizeof( struct_TestFileSysEntry ) ) - 1 ) != i )\r
{\r
- return _f_result( 4, 0 ); /* Fail, wrong file position */\r
+ return _f_result( __LINE__, 0 ); /* Fail, wrong file position */\r
}\r
\r
if ( F_NO_ERROR != f_seek( File, (long)( Pos - sizeof( struct_TestFileSysEntry ) ), F_SEEK_SET ) )\r
{\r
- return _f_result( 5, 0 ); /* Fail, could not go to new entry position */\r
+ return _f_result( __LINE__, 0 ); /* Fail, could not go to new entry position */\r
}\r
\r
if ( sizeof( struct_TestFileSysEntry ) != f_read( (void *)Entry, 1, sizeof( struct_TestFileSysEntry ), File ) )\r
{\r
- return _f_result( 6, 0 ); /* Fail, could not read the new entry */\r
+ return _f_result( __LINE__, 0 ); /* Fail, could not read the new entry */\r
}\r
\r
if ( ( Entry->MagicNum != 0xbc ) || ( Entry->Line != (int)i ) || ( Entry->Buf[0] != Ch ) || ( Entry->Buf[10] != Ch + 1 ) )\r
{\r
- return _f_result( 7, 0 ); /*Fail, the new entry is corrupted"*/\r
+ return _f_result( __LINE__, 0 ); /*Fail, the new entry is corrupted"*/\r
}\r
}\r
\r
ret = f_close( File );\r
if ( ret )\r
{\r
- return _f_result( 8, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
\r
File = f_open( "MyTest", "a+" );\r
if ( !File )\r
{\r
- return _f_result( 9, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
/* read records */\r
\r
if ( F_NO_ERROR != f_seek( File, 0, F_SEEK_SET ) )\r
{\r
- return _f_result( 10, 0 ); /* Fail, could not go to the start of the file */\r
+ return _f_result( __LINE__, 0 ); /* Fail, could not go to the start of the file */\r
}\r
\r
Founded = 0;\r
\r
if ( !Founded )\r
{\r
- return _f_result( 11, i ); /* Entry not founded */\r
+ return _f_result( __LINE__, i ); /* Entry not founded */\r
}\r
}\r
\r
ret = f_close( File );\r
if ( ret )\r
{\r
- return _f_result( 12, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
\r
ret = f_delete( "MyTest" );\r
if ( ret )\r
{\r
- return _f_result( 13, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
_f_dump( "passed..." );\r
file = f_open( "test.bin", "w+" );\r
if ( !file )\r
{\r
- return _f_result( 0, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
(void)psp_memset( testbuffer, 1, F_MAX_SEEK_TEST );\r
size = (unsigned long)f_write( testbuffer, 1, F_MAX_SEEK_TEST, file );\r
if ( size != F_MAX_SEEK_TEST )\r
{\r
- return _f_result( 1, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 2, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
file = f_truncate( "test.bin", F_MAX_SEEK_TEST - 4 );\r
if ( !file )\r
{\r
- return _f_result( 3, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 4, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
size = (unsigned long)f_filelength( "test.bin" );\r
if ( size != F_MAX_SEEK_TEST - 4 )\r
{\r
- return _f_result( 5, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
\r
file = f_truncate( "test.bin", F_MAX_SEEK_TEST );\r
if ( !file )\r
{\r
- return _f_result( 3, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 4, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
size = (unsigned long)f_filelength( "test.bin" );\r
if ( size != F_MAX_SEEK_TEST )\r
{\r
- return _f_result( 5, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
\r
file = f_truncate( "test.bin", ( F_MAX_SEEK_TEST / 2 ) - 92 );\r
if ( !file )\r
{\r
- return _f_result( 6, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
(void)psp_memset( testbuffer, 2, 92 );\r
size = (unsigned long)f_write( testbuffer, 1, 92, file );\r
if ( size != 92 )\r
{\r
- return _f_result( 7, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 8, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
size = (unsigned long)f_filelength( "test.bin" );\r
if ( size != ( F_MAX_SEEK_TEST / 2 ) )\r
{\r
- return _f_result( 9, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
\r
file = f_truncate( "test.bin", 1 );\r
if ( !file )\r
{\r
- return _f_result( 10, 0 );\r
+ return _f_result( __LINE__, 0 );\r
}\r
\r
(void)psp_memset( testbuffer, 3, 2 );\r
size = (unsigned long)f_write( testbuffer, 1, 2, file );\r
if ( size != 2 )\r
{\r
- return _f_result( 11, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
ret = f_close( file );\r
if ( ret )\r
{\r
- return _f_result( 12, ret );\r
+ return _f_result( __LINE__, ret );\r
}\r
\r
size = (unsigned long)f_filelength( "test.bin" );\r
if ( size != 3 )\r
{\r
- return _f_result( 13, size );\r
+ return _f_result( __LINE__, size );\r
}\r
\r
\r
break;\r
}\r
\r
- #if ( F_MAX_SEEK_TEST > 128 )\r
+#if ( F_MAX_SEEK_TEST > 128 )\r
\r
/* fall through */\r
case 6:\r
break;\r
}\r
\r
- #endif\r
- #if ( F_MAX_SEEK_TEST > 256 )\r
+#endif\r
+#if ( F_MAX_SEEK_TEST > 256 )\r
\r
/* fall through */\r
case 7:\r
break;\r
}\r
\r
- #endif\r
- #if ( F_MAX_SEEK_TEST > 512 )\r
+#endif\r
+#if ( F_MAX_SEEK_TEST > 512 )\r
\r
/* fall through */\r
case 8:\r
break;\r
}\r
\r
- #endif\r
- #if ( F_MAX_SEEK_TEST > 1024 )\r
+#endif\r
+#if ( F_MAX_SEEK_TEST > 1024 )\r
\r
/* fall through */\r
case 9:\r
break;\r
}\r
\r
- #endif\r
- #if ( F_MAX_SEEK_TEST > 2048 )\r
+#endif\r
+#if ( F_MAX_SEEK_TEST > 2048 )\r
\r
/* fall through */\r
case 10:\r
break;\r
}\r
\r
- #endif\r
- #if ( F_MAX_SEEK_TEST > 4096 )\r
+#endif\r
+#if ( F_MAX_SEEK_TEST > 4096 )\r
\r
/* fall through */\r
case 11:\r
break;\r
}\r
\r
- #endif\r
- #if ( F_MAX_SEEK_TEST > 8192 )\r
+#endif\r
+#if ( F_MAX_SEEK_TEST > 8192 )\r
\r
/* fall through */\r
case 12:\r
break;\r
}\r
\r
- #endif\r
- #if ( F_MAX_SEEK_TEST > 16384 )\r
+#endif\r
+#if ( F_MAX_SEEK_TEST > 16384 )\r
\r
/* fall through */\r
case 13:\r
break;\r
}\r
\r
- #endif\r
+#endif\r
\r
/* fall through */\r
case 14:\r
} /* f_dotest */\r
\r
\r
-\r
/****************************************************************************\r
*\r
* end of test.c\r
*\r
***************************************************************************/\r
-#endif /*_TEST_C_*/\r