2 * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @author Tomasz Iwanek (t.iwanek@samsung.com)
25 #include <dpl/test/test_runner.h>
26 #include <dpl/scoped_dir.h>
27 #include <dpl/scoped_free.h>
28 #include <dpl/utils/path.h>
29 #include <dpl/foreach.h>
30 #include <dpl/log/log.h>
31 #include <dpl/binary_queue.h>
32 #include <dpl/file_input.h>
33 #include <dpl/file_output.h>
38 using namespace DPL::Utils;
41 //do not used path here we test it
42 std::string rootTest = "/tmp/wrttest/";
45 #define ROOTGUARD_TESTMETHOD(FUNC) \
47 bool catched = false; \
50 } Catch(Path::RootDirectoryError) { \
53 RUNNER_ASSERT_MSG(catched, "Use of method should be protected against root diretory"); \
56 RUNNER_TEST_GROUP_INIT(DPL_Path)
60 Description: constructs paths in many ways
61 Expected: success full constrution
63 RUNNER_TEST(path_mkfile)
65 DPL::ScopedDir sd(rootTest);
68 memset(&st, 0, sizeof(struct stat));
69 Path path = Path(rootTest) / "touch.txt";
70 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) != 0, "File should not be created");
71 RUNNER_ASSERT(!path.Exists());
73 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) == 0, "File should be created");
74 RUNNER_ASSERT(path.Exists());
75 RUNNER_ASSERT(path.IsFile());
76 RUNNER_ASSERT(!path.IsDir());
77 RUNNER_ASSERT(!path.IsSymlink());
82 Description: tries to craete file when it exists
85 RUNNER_TEST(path_mkfile_exists)
87 DPL::ScopedDir sd(rootTest);
89 Path path = Path(rootTest) / "touch.txt";
91 RUNNER_ASSERT(path.Exists());
92 bool cannotCreate2ndTime = false;
97 Catch(Path::AlreadyExists)
99 cannotCreate2ndTime = true;
101 RUNNER_ASSERT_MSG(cannotCreate2ndTime, "File created should not be able to be created second time");
105 Name: path_mkfile_invalid_path
106 Description: tries to create file in not exisitng directory
107 Expected: failure at creation
109 RUNNER_TEST(path_mkfile_invalid_path)
111 DPL::ScopedDir sd(rootTest);
113 Path path = Path(rootTest) / "not_existing" / "touch.txt";
114 bool cannotCreate = false;
119 Catch(Path::OperationFailed)
123 RUNNER_ASSERT_MSG(cannotCreate, "File created should not be able to be created");
128 Description: creates valid directory
129 Expected: success direcotry creation
131 RUNNER_TEST(path_mkdir)
133 DPL::ScopedDir sd(rootTest);
136 memset(&st, 0, sizeof(struct stat));
137 Path path = Path(rootTest) / "touchDir";
138 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) != 0, "Directory should not be created");
139 RUNNER_ASSERT(!path.Exists());
141 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) == 0, "Directory should be created");
142 RUNNER_ASSERT(path.Exists());
143 RUNNER_ASSERT(!path.IsFile());
144 RUNNER_ASSERT(path.IsDir());
145 RUNNER_ASSERT(!path.IsSymlink());
150 Description: chekc if symlink is correctly recognized
151 Expected: method isSymlink returns true
153 RUNNER_TEST(path_symlink)
155 DPL::ScopedDir sd(rootTest);
158 memset(&st, 0, sizeof(struct stat));
159 Path path = Path(rootTest) / "symlink";
160 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) != 0, "Symlink should not be created");
161 RUNNER_ASSERT(!path.Exists());
162 (void)symlink("/nonexistisfile/file/file/file ", path.Fullpath().c_str());
163 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) == 0, "Symlink should be created");
164 RUNNER_ASSERT(path.Exists());
165 RUNNER_ASSERT(!path.IsFile());
166 RUNNER_ASSERT(!path.IsDir());
167 RUNNER_ASSERT(path.IsSymlink());
171 Name: path_construction_empty
172 Description: tries to construct empty path
175 RUNNER_TEST(path_construction_empty)
180 Path path1(std::string(""));
182 Catch(Path::EmptyPath)
186 RUNNER_ASSERT_MSG(passed, "Construction with empty path do not fails");
190 Name: path_construction_root
191 Description: tries to construct root path
194 RUNNER_TEST(path_construction_root)
196 Path path1(std::string("/"));
197 RUNNER_ASSERT(path1.Fullpath() == "/");
198 RUNNER_ASSERT(path1.Filename() == "");
202 RUNNER_ASSERT(path1.DirectoryName() == "/");
204 Catch(Path::InternalError)
208 RUNNER_ASSERT_MSG(passed, "Directory name for root should be an error");
212 Name: path_construction_1
213 Description: constructs paths in many ways
214 Expected: success full constrution
216 RUNNER_TEST(path_construction_1)
218 DPL::ScopedFree<char> sf(getcwd(NULL, 0));
220 Path path1(std::string("/test/bin/file"));
221 RUNNER_ASSERT(path1.Fullpath() == "/test/bin/file");
222 RUNNER_ASSERT(path1.Filename() == "file");
223 RUNNER_ASSERT(path1.DirectoryName() == "/test/bin");
227 Name: path_construction_2
228 Description: constructs paths in many ways
229 Expected: success full constrution
231 RUNNER_TEST(path_construction_2)
233 DPL::ScopedFree<char> sf(getcwd(NULL, 0));
234 std::string cwd(sf.Get());
236 Path path2(std::string("test/bin/file.eas"));
237 RUNNER_ASSERT(path2.Fullpath() == cwd + "/test/bin/file.eas");
238 RUNNER_ASSERT(path2.Filename() == "file.eas");
239 RUNNER_ASSERT(path2.DirectoryName() == cwd + "/test/bin");
243 Name: path_construction_3
244 Description: constructs paths in many ways
245 Expected: success full constrution
247 RUNNER_TEST(path_construction_3)
249 DPL::ScopedFree<char> sf(getcwd(NULL, 0));
250 std::string cwd(sf.Get());
252 Path path3("test/23/abc");
253 RUNNER_ASSERT(path3.Fullpath() == cwd + "/test/23/abc");
254 RUNNER_ASSERT(path3.Filename() == "abc");
255 RUNNER_ASSERT(path3.DirectoryName() == cwd + "/test/23");
259 Name: path_construction_4
260 Description: constructs paths in many ways
261 Expected: success full constrution
263 RUNNER_TEST(path_construction_4)
265 DPL::ScopedFree<char> sf(getcwd(NULL, 0));
267 Path path4("/test/bin/abc");
268 RUNNER_ASSERT(path4.Fullpath() == "/test/bin/abc");
269 RUNNER_ASSERT(path4.Filename() == "abc");
270 RUNNER_ASSERT(path4.DirectoryName() == "/test/bin");
274 Name: path_construction_5
275 Description: constructs paths in many ways
276 Expected: success full constrution
278 RUNNER_TEST(path_construction_5)
280 DPL::ScopedFree<char> sf(getcwd(NULL, 0));
281 std::string cwd(sf.Get());
283 Path path5(DPL::String(L"test/bin/file.st.exe"));
284 RUNNER_ASSERT(path5.Fullpath() == cwd + "/test/bin/file.st.exe");
285 RUNNER_ASSERT(path5.Filename() == "file.st.exe");
286 RUNNER_ASSERT(path5.DirectoryName() == cwd + "/test/bin");
290 Name: path_construction_6
291 Description: constructs paths in many ways
292 Expected: success full constrution
294 RUNNER_TEST(path_construction_6)
296 DPL::ScopedFree<char> sf(getcwd(NULL, 0));
298 Path path6(DPL::String(L"/test/bin/file"));
299 RUNNER_ASSERT(path6.Fullpath() == "/test/bin/file");
300 RUNNER_ASSERT(path6.Filename() == "file");
301 RUNNER_ASSERT(path6.DirectoryName() == "/test/bin");
305 Name: path_construction_7
306 Description: constructs paths in many ways
307 Expected: success full constrution
309 RUNNER_TEST(path_construction_7)
311 DPL::ScopedFree<char> sf(getcwd(NULL, 0));
312 std::string cwd(sf.Get());
314 Path path7 = Path("test") / "a///23/lol";
315 RUNNER_ASSERT(path7.Fullpath() == cwd + "/test/a/23/lol");
316 RUNNER_ASSERT(path7.Filename() == "lol");
317 RUNNER_ASSERT(path7.DirectoryName() == cwd + "/test/a/23");
321 Name: path_construction_8
322 Description: constructs paths in many ways
323 Expected: success full constrution
325 RUNNER_TEST(path_construction_8)
327 DPL::ScopedFree<char> sf(getcwd(NULL, 0));
329 Path path8 = Path("/test/bin/") / "123" / "dir1.dll";
330 RUNNER_ASSERT(path8.Fullpath() == "/test/bin/123/dir1.dll");
331 RUNNER_ASSERT(path8.Filename() == "dir1.dll");
332 RUNNER_ASSERT(path8.DirectoryName() == "/test/bin/123");
336 Name: path_construction_9
337 Description: constructs paths in many ways
338 Expected: success full constrution
340 RUNNER_TEST(path_construction_9)
342 DPL::ScopedFree<char> sf(getcwd(NULL, 0));
344 Path path9 = Path("/test/bin/file.txt//");
345 RUNNER_ASSERT(path9.Fullpath() == "/test/bin/file.txt");
346 RUNNER_ASSERT(path9.Filename() == "file.txt");
347 RUNNER_ASSERT(path9.DirectoryName() == "/test/bin");
351 Name: path_construction_10
352 Description: constructs paths by appending
353 Expected: success full constrution
355 RUNNER_TEST(path_construction_10)
357 Path path10 = Path("/test/");
359 path10 /= std::string("two");
360 path10 /= DPL::String(L"three");
361 RUNNER_ASSERT(path10.Fullpath() == "/test/one/two/three");
362 RUNNER_ASSERT(path10.Filename() == "three");
363 RUNNER_ASSERT(path10.DirectoryName() == "/test/one/two");
368 Description: tests removing paths
369 Expected: successfull path remove
371 RUNNER_TEST(path_remove_valid)
373 DPL::ScopedDir sd(rootTest);
376 memset(&st, 0, sizeof(struct stat));
377 Path path = Path(rootTest) / "touchDir";
378 RUNNER_ASSERT(!path.Exists());
381 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) == 0, "Directory should be created");
382 RUNNER_ASSERT(path.Exists());
385 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) != 0, "Directory should not be created");
386 RUNNER_ASSERT(!path.Exists());
389 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) == 0, "File should be created");
390 RUNNER_ASSERT(path.Exists());
393 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) != 0, "File should not be created");
394 RUNNER_ASSERT(!path.Exists());
398 Name: path_try_remove
399 Description: tests removing paths
400 Expected: successfull path remove once
402 RUNNER_TEST(path_try_remove_valid)
404 DPL::ScopedDir sd(rootTest);
407 memset(&st, 0, sizeof(struct stat));
408 Path path = Path(rootTest) / "touchDir";
409 RUNNER_ASSERT(!path.Exists());
412 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) == 0, "Directory should be created");
413 RUNNER_ASSERT(path.Exists());
415 RUNNER_ASSERT(TryRemove(path));
416 RUNNER_ASSERT(!TryRemove(path));
417 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) != 0, "Directory should not be created");
418 RUNNER_ASSERT(!path.Exists());
421 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) == 0, "File should be created");
422 RUNNER_ASSERT(path.Exists());
424 RUNNER_ASSERT(TryRemove(path));
425 RUNNER_ASSERT(!TryRemove(path));
426 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) != 0, "File should not be created");
427 RUNNER_ASSERT(!path.Exists());
431 Name: path_remove_invalid
432 Description: tests removing invalid paths
433 Expected: failure at path remove
435 RUNNER_TEST(path_remove_invalid)
437 DPL::ScopedDir sd(rootTest);
439 Path path = Path(rootTest) / "touchDir";
441 bool removedNotExisting = true;
446 Catch(Path::OperationFailed)
448 removedNotExisting = false;
450 RUNNER_ASSERT_MSG(!removedNotExisting, "Removing not existing file");
455 Description: tests path renaming
456 Expected: path is successfully renamed
458 RUNNER_TEST(path_rename)
460 DPL::ScopedDir sd(rootTest);
463 memset(&st, 0, sizeof(struct stat));
464 Path path = Path(rootTest) / "touchDir";
465 Path dirpath = Path(rootTest) / "directory";
466 Path path2 = dirpath / "touchDir2";
471 RUNNER_ASSERT_MSG(lstat(path.Fullpath().c_str(), &st) == 0, "File should be created");
472 RUNNER_ASSERT(path.Exists());
473 RUNNER_ASSERT(!path2.Exists());
476 RUNNER_ASSERT(!path.Exists());
477 RUNNER_ASSERT(path2.Exists());
480 RUNNER_ASSERT(path.Exists());
481 RUNNER_ASSERT(!path2.Exists());
485 Name: path_rename_xdev
486 Description: tests path renaming between devices
487 Expected: path is successfully renamed
489 RUNNER_TEST(path_rename_xdev)
491 //assuming /opt/usr and /usr is normally on other partitions on device
493 Path path = Path("/opt/usr") / "touchDir";
494 Path dirpath = path / "directory";
495 Path filepath = path / "file.txt";
497 Path path2 = Path("/usr") / "touchDir2";
498 Path dirpath2 = path2 / "directory";
499 Path filepath2 = path2 / "file.txt";
505 MakeEmptyFile(filepath);
507 RUNNER_ASSERT(path.Exists());
508 RUNNER_ASSERT(dirpath.Exists());
509 RUNNER_ASSERT(filepath.Exists());
510 RUNNER_ASSERT(!path2.Exists());
511 RUNNER_ASSERT(!dirpath2.Exists());
512 RUNNER_ASSERT(!filepath2.Exists());
515 RUNNER_ASSERT(!path.Exists());
516 RUNNER_ASSERT(!dirpath.Exists());
517 RUNNER_ASSERT(!filepath.Exists());
518 RUNNER_ASSERT(path2.Exists());
519 RUNNER_ASSERT(dirpath2.Exists());
520 RUNNER_ASSERT(filepath2.Exists());
523 RUNNER_ASSERT(path.Exists());
524 RUNNER_ASSERT(dirpath.Exists());
525 RUNNER_ASSERT(filepath.Exists());
526 RUNNER_ASSERT(!path2.Exists());
527 RUNNER_ASSERT(!dirpath2.Exists());
528 RUNNER_ASSERT(!filepath2.Exists());
534 * Name: path_basename
535 * Description: check basename equivalents
538 RUNNER_TEST(path_basename)
540 DPL::ScopedDir sd(rootTest);
541 Path path = Path(rootTest) / "directory" / "touch.txt";
542 RUNNER_ASSERT(path.DirectoryName() == path.DirectoryPath().Fullpath());
543 RUNNER_ASSERT(path.DirectoryPath().DirectoryName() == path.DirectoryPath().DirectoryPath().Fullpath());
548 * Description: check if operations cannot be executed on root directory
550 * This is check because of default path is root and it should not be used usually
551 * Default constructor is unfortnatelly easier to use
555 RUNNER_TEST(path_safe)
557 DPL::ScopedDir sd(rootTest);
558 Path normal = Path(rootTest) / "directory" / "touch.txt";
560 ROOTGUARD_TESTMETHOD( Rename(normal, root) );
561 ROOTGUARD_TESTMETHOD( Rename(root, root) );
562 ROOTGUARD_TESTMETHOD( Rename(root, normal) );
563 ROOTGUARD_TESTMETHOD( CopyDir(normal, root) );
564 ROOTGUARD_TESTMETHOD( CopyDir(root, root) );
565 ROOTGUARD_TESTMETHOD( CopyDir(root, normal) );
566 ROOTGUARD_TESTMETHOD( CopyFile(normal, root) );
567 ROOTGUARD_TESTMETHOD( CopyFile(root, root) );
568 ROOTGUARD_TESTMETHOD( CopyFile(root, normal) );
569 ROOTGUARD_TESTMETHOD( Remove(root) );
570 ROOTGUARD_TESTMETHOD( MakeEmptyFile(root) );
571 ROOTGUARD_TESTMETHOD( MakeDir(root) );
576 * Description: check testing size of file
577 * Expected: correct size
579 RUNNER_TEST(path_size)
581 DPL::ScopedDir sd(rootTest);
582 Path path = Path(rootTest) / "touch.txt";
583 DPL::Utils::MakeEmptyFile(path);
584 RUNNER_ASSERT(path.Size() == 0);
587 DPL::FileOutput out(path.Fullpath());
589 bq.AppendCopy("123456789", 9);
590 out.Write(bq, bq.Size());
592 RUNNER_ASSERT(path.Size() == 9);
596 DPL::FileOutput out(path.Fullpath());
598 bq.AppendCopy("123456789", 4);
599 out.Write(bq, bq.Size());
601 RUNNER_ASSERT(path.Size() == 4);
607 Description: tests path coping directory andfiles
608 Expected: coping should be done
610 RUNNER_TEST(path_copy_directory)
612 DPL::ScopedDir sd(rootTest);
614 Path path = Path(rootTest) / "sourceDir";
615 Path innerPath = Path(rootTest) / "sourceDir" / "level1" ;
616 Path innerPath2 = Path(rootTest) / "sourceDir" / "level1" / "level2";
617 Path file1 = Path(rootTest) / "sourceDir" / "level1" / "level2" / "file1.txt";
618 Path file2 = Path(rootTest) / "sourceDir" / "level1" / "level2" / "file2.txt";
619 Path file3 = Path(rootTest) / "sourceDir" / "level1" / "file3.txt";
620 Path file4 = Path(rootTest) / "sourceDir" / "file4.txt";
622 Path tfile1 = Path(rootTest) / "targetDir" / "level1" / "level2" / "file1.txt";
623 Path tfile2 = Path(rootTest) / "targetDir" / "level1" / "level2" / "file2.txt";
624 Path tfile3 = Path(rootTest) / "targetDir" / "level1" / "file3.txt";
625 Path tfile4 = Path(rootTest) / "targetDir" / "file4.txt";
627 Path target = Path(rootTest) / "targetDir";
629 DPL::Utils::MakeDir(path);
630 DPL::Utils::MakeDir(innerPath);
631 DPL::Utils::MakeDir(innerPath2);
632 DPL::Utils::MakeEmptyFile(file1);
633 DPL::Utils::MakeEmptyFile(file2);
634 DPL::Utils::MakeEmptyFile(file3);
635 DPL::Utils::MakeEmptyFile(file4);
637 DPL::Utils::CopyDir(path, target);
639 RUNNER_ASSERT_MSG(tfile1.Exists(), tfile1.Fullpath() + " not exists");
640 RUNNER_ASSERT_MSG(tfile1.IsFile(), tfile1.Fullpath() + " is not file");
641 RUNNER_ASSERT_MSG(tfile2.Exists(), tfile2.Fullpath() + " not exists");
642 RUNNER_ASSERT_MSG(tfile2.IsFile(), tfile2.Fullpath() + " is not file");
643 RUNNER_ASSERT_MSG(tfile3.Exists(), tfile3.Fullpath() + " not exists");
644 RUNNER_ASSERT_MSG(tfile3.IsFile(), tfile3.Fullpath() + " is not file");
645 RUNNER_ASSERT_MSG(tfile4.Exists(), tfile4.Fullpath() + " not exists");
646 RUNNER_ASSERT_MSG(tfile4.IsFile(), tfile4.Fullpath() + " is not file");
650 Name: path_copy_inner
651 Description: tests path coping to subdirectory
652 Expected: coping shoudl fail
654 RUNNER_TEST(path_copy_inner)
656 DPL::ScopedDir sd(rootTest);
658 Path path = Path(rootTest) / "touchDir";
659 Path inner = Path(rootTest) / "touchDir" / "innerDirectory";
661 bool exceptionCatched = false;
664 DPL::Utils::CopyDir(path, inner);
666 Catch(DPL::Utils::Path::CannotCopy)
668 exceptionCatched = true;
670 RUNNER_ASSERT_MSG(exceptionCatched, "Copy should fail");
675 Description: tests method compare if one path is subpath of another
676 Expected: correct results
678 RUNNER_TEST(path_issubpath)
680 Path path1 = Path(rootTest) / "touchDir/asd/sdf";
681 Path path2 = Path(rootTest) / "touchDir/asd/sdf/123";
682 Path path3 = Path(rootTest) / "touchDir/asd/sdno";
683 Path path4 = Path("/");
685 RUNNER_ASSERT(path1.isSubPath(path2));
686 RUNNER_ASSERT(!path1.isSubPath(path3));
687 RUNNER_ASSERT(!path1.isSubPath(path4));
689 RUNNER_ASSERT(!path2.isSubPath(path1));
690 RUNNER_ASSERT(!path2.isSubPath(path3));
691 RUNNER_ASSERT(!path2.isSubPath(path4));
693 RUNNER_ASSERT(path4.isSubPath(path1));
694 RUNNER_ASSERT(path4.isSubPath(path2));
695 RUNNER_ASSERT(path4.isSubPath(path3));
699 Name: path_rename_same
700 Description: tests if renam does not brokens file if target location is equal to source location
701 Expected: path is avaliable
703 RUNNER_TEST(path_rename_same)
705 DPL::ScopedDir sd(rootTest);
708 memset(&st, 0, sizeof(struct stat));
709 Path path = Path(rootTest) / "touchDir";
713 RUNNER_ASSERT(path.Exists());
717 Name: path_iterate_not_directory
718 Description: iterates not a directory
719 Expected: success full constrution
721 RUNNER_TEST(path_iterate_not_directory)
723 DPL::ScopedDir sd(rootTest);
725 Path fileTest = Path(rootTest) / "file.txt";
726 MakeEmptyFile(fileTest);
731 FOREACH(file, fileTest)
736 Catch(Path::NotDirectory)
740 RUNNER_ASSERT(passed);
744 Name: path_construction
745 Description: constructs paths in many ways
746 Expected: success full constrution
748 RUNNER_TEST(path_iterate_empty_directory)
750 DPL::ScopedDir sd(rootTest);
752 Path dirTest = Path(rootTest) / "directory";
758 FOREACH(file, dirTest)
761 LogError("Directory should be empty");
764 Catch(Path::NotDirectory)
767 LogError("Directory should exists");
769 RUNNER_ASSERT(passed);
773 Name: path_construction
774 Description: constructs paths in many ways
775 Expected: success full constrution
777 RUNNER_TEST(path_iterate_notempty_directory)
779 DPL::ScopedDir sd(rootTest);
781 Path dirTest = Path(rootTest) / "directory";
783 Path path1 = Path(rootTest) / "directory" / "file1";
784 Path path2 = Path(rootTest) / "directory" / "file2";
785 Path path3 = Path(rootTest) / "directory" / "file3";
787 std::set<std::string> resultSet;
788 std::set<std::string> testSet;
789 testSet.insert(path1.Fullpath());
790 testSet.insert(path2.Fullpath());
791 testSet.insert(path3.Fullpath());
794 MakeEmptyFile(path1);
795 MakeEmptyFile(path2);
796 MakeEmptyFile(path3);
798 FOREACH(file, dirTest)
800 resultSet.insert(file->Fullpath());
803 RUNNER_ASSERT_MSG(testSet == resultSet, "Testing");
807 Name: path_construction
808 Description: constructs paths in many ways
809 Expected: success full constrution
811 RUNNER_TEST(path_iterator_copy_constructor)
813 DPL::ScopedDir sd(rootTest);
815 Path dirTest = Path(rootTest) / "directory";
817 Path path1 = Path(rootTest) / "directory" / "file1";
818 Path path2 = Path(rootTest) / "directory" / "file2";
819 Path path3 = Path(rootTest) / "directory" / "file3";
822 MakeEmptyFile(path1);
823 MakeEmptyFile(path2);
824 MakeEmptyFile(path3);
826 std::shared_ptr<Path::Iterator> iter1(new Path::Iterator((Path(rootTest) / "directory").Fullpath().c_str()));
828 //as it's input iterator it's guaranteed for one element to be iterate only once
830 std::shared_ptr<Path::Iterator> iter2(new Path::Iterator( (*iter1)));
834 RUNNER_ASSERT_MSG(*iter2 == dirTest.end(), "Iterator is in broken state");