comparison UnitTestsSources/ServerIndexTests.cpp @ 1162:1ea4094d077c db-changes

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 17 Sep 2014 13:25:37 +0200
parents 8f9d49192815
children 5b2d8c280ac2
comparison
equal deleted inserted replaced
1161:82cbf1480aac 1162:1ea4094d077c
543 ASSERT_EQ(4u, index_->IncrementGlobalSequence(GlobalProperty_AnonymizationSequence)); 543 ASSERT_EQ(4u, index_->IncrementGlobalSequence(GlobalProperty_AnonymizationSequence));
544 } 544 }
545 545
546 546
547 547
548 TEST_P(DatabaseWrapperTest, LookupTagValue) 548 TEST_P(DatabaseWrapperTest, LookupIdentifier)
549 { 549 {
550 int64_t a[] = { 550 int64_t a[] = {
551 index_->CreateResource("a", ResourceType_Study), // 0 551 index_->CreateResource("a", ResourceType_Study), // 0
552 index_->CreateResource("b", ResourceType_Study), // 1 552 index_->CreateResource("b", ResourceType_Study), // 1
553 index_->CreateResource("c", ResourceType_Study), // 2 553 index_->CreateResource("c", ResourceType_Study), // 2
560 m.Clear(); m.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "0"); index_->SetMainDicomTags(a[2], m); 560 m.Clear(); m.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "0"); index_->SetMainDicomTags(a[2], m);
561 m.Clear(); m.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, "0"); index_->SetMainDicomTags(a[3], m); 561 m.Clear(); m.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, "0"); index_->SetMainDicomTags(a[3], m);
562 562
563 std::list<int64_t> s; 563 std::list<int64_t> s;
564 564
565 index_->LookupTagValue(s, DICOM_TAG_STUDY_INSTANCE_UID, "0"); 565 index_->LookupIdentifier(s, DICOM_TAG_STUDY_INSTANCE_UID, "0");
566 ASSERT_EQ(2u, s.size()); 566 ASSERT_EQ(2u, s.size());
567 ASSERT_TRUE(std::find(s.begin(), s.end(), a[0]) != s.end()); 567 ASSERT_TRUE(std::find(s.begin(), s.end(), a[0]) != s.end());
568 ASSERT_TRUE(std::find(s.begin(), s.end(), a[2]) != s.end()); 568 ASSERT_TRUE(std::find(s.begin(), s.end(), a[2]) != s.end());
569 569
570 index_->LookupTagValue(s, "0"); 570 index_->LookupIdentifier(s, "0");
571 ASSERT_EQ(3u, s.size()); 571 ASSERT_EQ(3u, s.size());
572 ASSERT_TRUE(std::find(s.begin(), s.end(), a[0]) != s.end()); 572 ASSERT_TRUE(std::find(s.begin(), s.end(), a[0]) != s.end());
573 ASSERT_TRUE(std::find(s.begin(), s.end(), a[2]) != s.end()); 573 ASSERT_TRUE(std::find(s.begin(), s.end(), a[2]) != s.end());
574 ASSERT_TRUE(std::find(s.begin(), s.end(), a[3]) != s.end()); 574 ASSERT_TRUE(std::find(s.begin(), s.end(), a[3]) != s.end());
575 575
576 index_->LookupTagValue(s, DICOM_TAG_STUDY_INSTANCE_UID, "1"); 576 index_->LookupIdentifier(s, DICOM_TAG_STUDY_INSTANCE_UID, "1");
577 ASSERT_EQ(1u, s.size()); 577 ASSERT_EQ(1u, s.size());
578 ASSERT_TRUE(std::find(s.begin(), s.end(), a[1]) != s.end()); 578 ASSERT_TRUE(std::find(s.begin(), s.end(), a[1]) != s.end());
579 579
580 index_->LookupTagValue(s, "1"); 580 index_->LookupIdentifier(s, "1");
581 ASSERT_EQ(1u, s.size()); 581 ASSERT_EQ(1u, s.size());
582 ASSERT_TRUE(std::find(s.begin(), s.end(), a[1]) != s.end()); 582 ASSERT_TRUE(std::find(s.begin(), s.end(), a[1]) != s.end());
583 583
584 584
585 /*{ 585 /*{
586 std::list<std::string> s; 586 std::list<std::string> s;
587 context.GetIndex().LookupTagValue(s, DICOM_TAG_STUDY_INSTANCE_UID, "1.2.250.1.74.20130819132500.29000036381059"); 587 context.GetIndex().LookupIdentifier(s, DICOM_TAG_STUDY_INSTANCE_UID, "1.2.250.1.74.20130819132500.29000036381059");
588 for (std::list<std::string>::iterator i = s.begin(); i != s.end(); i++) 588 for (std::list<std::string>::iterator i = s.begin(); i != s.end(); i++)
589 { 589 {
590 std::cout << "*** " << *i << std::endl;; 590 std::cout << "*** " << *i << std::endl;;
591 } 591 }
592 }*/ 592 }*/