Mercurial > hg > orthanc
comparison UnitTests/main.cpp @ 483:8c3573d28868
export dicom instances to the filesystem
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 16 Jul 2013 12:01:39 +0200 |
parents | 4aae0261515e |
children | b22312081388 09b836088f63 |
comparison
equal
deleted
inserted
replaced
482:b05eb8708aee | 483:8c3573d28868 |
---|---|
449 { | 449 { |
450 } | 450 } |
451 } | 451 } |
452 | 452 |
453 | 453 |
454 TEST(Toolbox, WriteFile) | |
455 { | |
456 std::string path; | |
457 | |
458 { | |
459 Toolbox::TemporaryFile tmp; | |
460 path = tmp.GetPath(); | |
461 | |
462 std::string s; | |
463 s.append("Hello"); | |
464 s.push_back('\0'); | |
465 s.append("World"); | |
466 ASSERT_EQ(11u, s.size()); | |
467 | |
468 Toolbox::WriteFile(s, path.c_str()); | |
469 | |
470 std::string t; | |
471 Toolbox::ReadFile(t, path.c_str()); | |
472 | |
473 ASSERT_EQ(11u, t.size()); | |
474 ASSERT_EQ(0, t[5]); | |
475 ASSERT_EQ(0, memcmp(s.c_str(), t.c_str(), s.size())); | |
476 } | |
477 | |
478 std::string u; | |
479 ASSERT_THROW(Toolbox::ReadFile(u, path.c_str()), OrthancException); | |
480 } | |
481 | |
482 | |
454 int main(int argc, char **argv) | 483 int main(int argc, char **argv) |
455 { | 484 { |
456 // Initialize Google's logging library. | 485 // Initialize Google's logging library. |
457 FLAGS_logtostderr = true; | 486 FLAGS_logtostderr = true; |
458 FLAGS_minloglevel = 0; | 487 FLAGS_minloglevel = 0; |