Mercurial > hg > orthanc
comparison UnitTestsSources/ServerIndex.cpp @ 705:a9cff2c077d4
notes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 13 Feb 2014 11:54:00 +0100 |
parents | dd1ce9a2844c |
children | 2d829ea1db96 |
comparison
equal
deleted
inserted
replaced
704:4789da60d655 | 705:a9cff2c077d4 |
---|---|
1 #include "gtest/gtest.h" | 1 #include "gtest/gtest.h" |
2 | 2 |
3 #include "../OrthancServer/DatabaseWrapper.h" | 3 #include "../OrthancServer/DatabaseWrapper.h" |
4 #include "../OrthancServer/ServerContext.h" | |
5 #include "../OrthancServer/ServerIndex.h" | |
4 #include "../Core/Uuid.h" | 6 #include "../Core/Uuid.h" |
5 | 7 |
6 #include <ctype.h> | 8 #include <ctype.h> |
7 #include <glog/logging.h> | 9 #include <glog/logging.h> |
8 #include <algorithm> | 10 #include <algorithm> |
506 { | 508 { |
507 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_PATIENT_ID)); | 509 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_PATIENT_ID)); |
508 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_PATIENT_ID, ResourceType_Patient)); | 510 ASSERT_TRUE(DicomMap::IsMainDicomTag(DICOM_TAG_PATIENT_ID, ResourceType_Patient)); |
509 ASSERT_FALSE(DicomMap::IsMainDicomTag(DICOM_TAG_PATIENT_ID, ResourceType_Study)); | 511 ASSERT_FALSE(DicomMap::IsMainDicomTag(DICOM_TAG_PATIENT_ID, ResourceType_Study)); |
510 } | 512 } |
513 | |
514 | |
515 | |
516 TEST(DatabaseWrapper, AttachmentRecycling) | |
517 { | |
518 const std::string path = "OrthancStorageUnitTests"; | |
519 Toolbox::RemoveFile(path + "/index"); | |
520 ServerContext context(path, ":memory:"); | |
521 ServerIndex& index = context.GetIndex(); | |
522 | |
523 Json::Value tmp; | |
524 index.ComputeStatistics(tmp); | |
525 ASSERT_EQ(0, tmp["PatientCount"].asInt()); | |
526 | |
527 ServerIndex::Attachments attachments; | |
528 | |
529 DicomMap instance; | |
530 m.SetValue(DICOM_TAG_PATIENT_ID, "patient1"); | |
531 m.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "study1"); | |
532 m.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, "series1"); | |
533 m.SetValue(DICOM_TAG_SOP_INSTANCE_UID, "instance1"); | |
534 ASSERT_EQ(StoreStatus_Success, index.Store(instance, attachments, "")); | |
535 } |