/*! ========================================================================
** Extended Template and Library Test Suite
** stringf Procedure Test
-** $Id: stringf.cpp,v 1.1.1.1 2005/01/04 01:31:48 darco Exp $
+** $Id$
**
** Copyright (c) 2002 Robert B. Quattlebaum Jr.
**
int ret=0;
char mystring[80]="My formatted string!";
string myotherstring="my other string!";
-
+
cout<<strprintf("This is a test of >>%s<<.",mystring)<<endl;
myotherstring="5 6.75 George 7";
int i,i2;
float f;
-
+
#ifndef ETL_NO_STRSCANF
strscanf(myotherstring,"%d %f %s %d",&i, &f, mystring, &i2);
#else
if(relative_path(curr_path,dest_path)!=unix_to_local_path("../../share"))
cerr<<"Bad relative path"<<endl,ret++;
-
+ cout<<endl;
+
+ curr_path=unix_to_local_path("/home/darco/projects/voria");
+ dest_path=unix_to_local_path("/home/darco/projects/voria/myfile.txt");
+ cout<<"curr_path="<<curr_path<<" dest_path="<<dest_path<<endl;
+ cout<<"relative_path="<<relative_path(curr_path,dest_path)<<endl;
+ if(relative_path(curr_path,dest_path)!=unix_to_local_path("myfile.txt"))
+ cerr<<"Bad relative path"<<endl,ret++;
+
+ cout<<endl;
+
+ curr_path=unix_to_local_path("/home/darco/projects/voria");
+ dest_path=unix_to_local_path("/home/darco/projects/voria/files/myfile.txt");
+ cout<<"curr_path="<<curr_path<<" dest_path="<<dest_path<<endl;
+ cout<<"relative_path="<<relative_path(curr_path,dest_path)<<endl;
+ if(relative_path(curr_path,dest_path)!=unix_to_local_path("files/myfile.txt"))
+ cerr<<"Bad relative path"<<endl,ret++;
+
+ cout<<endl;
+
curr_path=unix_to_local_path("/usr/local/../include/sys/../linux/linux.h");
cout<<"dirty_path="<<curr_path<<endl;
cout<<"clean_path="<<cleanup_path(curr_path)<<endl;
int main()
{
int error=0;
-
+
error+=basic_test();
error+=base_and_dir_name_test();
error+=relative_path_test();