فهرست منبع

Fixed density test due to no density in meta

  density and _density are no longer stored in meta but rather in dscan.
david 3 سال پیش
والد
کامیت
eab09e3f86
1فایلهای تغییر یافته به همراه14 افزوده شده و 14 حذف شده
  1. 14 14
      test-director.cpp

+ 14 - 14
test-director.cpp

@@ -137,8 +137,6 @@ TEST(director, director_parsing_density) {
   // Check that each sector was correctly processed
   std::vector<int> sectors = {70, 441, 575, 600, 629, 711};
 
-  const char * D = "_density";
-
   json sector_data;
   sector_data[70]["density"] = 0;
   sector_data[70]["warps"] = 6;
@@ -171,23 +169,25 @@ TEST(director, director_parsing_density) {
   sector_data[711]["anom"] = false;
   sector_data[711]["known"] = true;
 
-  for (auto sector : sectors) {
-    std::string sector_text = std::to_string(sector);
+  density_scan &ds = dir.galaxy.dscan;
+
+  for (int x = 0; x < ds.pos; ++x) {
+    int sector = sectors[x];
     // GTEST_COUT << "Testing Sector " << sector << std::endl;
-    EXPECT_EQ(json_int(dir.galaxy.meta[D][sector_text]["density"]),
-              sector_data[sector]["density"])
+    EXPECT_EQ(ds.d[x].density,
+              json_int(sector_data[sector]["density"]))
         << "Sector " << sector << " density";
-    EXPECT_EQ(json_int(dir.galaxy.meta[D][sector_text]["warps"]),
-              sector_data[sector]["warps"])
+    EXPECT_EQ(ds.d[x].warps,
+              json_int(sector_data[sector]["warps"]))
         << "Sector " << sector << " warps";
-    EXPECT_EQ(json_int(dir.galaxy.meta[D][sector_text]["navhaz"]),
-              (int)sector_data[sector]["navhaz"])
+    EXPECT_EQ(ds.d[x].navhaz,
+              json_int(sector_data[sector]["navhaz"]))
         << "Sector " << sector << " navhaz";
-    EXPECT_EQ(dir.galaxy.meta[D][sector_text]["anom"],
-              (bool)sector_data[sector]["anom"])
+    EXPECT_EQ(ds.d[x].anomaly,
+              json_bool(sector_data[sector]["anom"]))
         << "Sector " << sector << " anom";
-    EXPECT_EQ(dir.galaxy.meta[D][sector_text]["known"],
-              (bool)sector_data[sector]["known"])
+    EXPECT_EQ(ds.d[x].known,
+              json_bool(sector_data[sector]["known"]))
         << "Sector " << sector << " known";
   }
 }