瀏覽代碼

Update density to _density in tests.

Steve Thielemann 3 年之前
父節點
當前提交
57e3dbd200
共有 1 個文件被更改,包括 7 次插入5 次删除
  1. 7 5
      test-director.cpp

+ 7 - 5
test-director.cpp

@@ -137,6 +137,8 @@ TEST(director, director_parsing_density) {
   // Check that each sector was correctly processed
   // Check that each sector was correctly processed
   std::vector<int> sectors = {70, 441, 575, 600, 629, 711};
   std::vector<int> sectors = {70, 441, 575, 600, 629, 711};
 
 
+  const char * D = "_density";
+
   json sector_data;
   json sector_data;
   sector_data[70]["density"] = 0;
   sector_data[70]["density"] = 0;
   sector_data[70]["warps"] = 6;
   sector_data[70]["warps"] = 6;
@@ -172,19 +174,19 @@ TEST(director, director_parsing_density) {
   for (auto sector : sectors) {
   for (auto sector : sectors) {
     std::string sector_text = std::to_string(sector);
     std::string sector_text = std::to_string(sector);
     // GTEST_COUT << "Testing Sector " << sector << std::endl;
     // GTEST_COUT << "Testing Sector " << sector << std::endl;
-    EXPECT_EQ(json_int(dir.galaxy.meta["density"][sector_text]["density"]),
+    EXPECT_EQ(json_int(dir.galaxy.meta[D][sector_text]["density"]),
               sector_data[sector]["density"])
               sector_data[sector]["density"])
         << "Sector " << sector << " density";
         << "Sector " << sector << " density";
-    EXPECT_EQ(json_int(dir.galaxy.meta["density"][sector_text]["warps"]),
+    EXPECT_EQ(json_int(dir.galaxy.meta[D][sector_text]["warps"]),
               sector_data[sector]["warps"])
               sector_data[sector]["warps"])
         << "Sector " << sector << " warps";
         << "Sector " << sector << " warps";
-    EXPECT_EQ(json_int(dir.galaxy.meta["density"][sector_text]["navhaz"]),
+    EXPECT_EQ(json_int(dir.galaxy.meta[D][sector_text]["navhaz"]),
               (int)sector_data[sector]["navhaz"])
               (int)sector_data[sector]["navhaz"])
         << "Sector " << sector << " navhaz";
         << "Sector " << sector << " navhaz";
-    EXPECT_EQ(dir.galaxy.meta["density"][sector_text]["anom"],
+    EXPECT_EQ(dir.galaxy.meta[D][sector_text]["anom"],
               (bool)sector_data[sector]["anom"])
               (bool)sector_data[sector]["anom"])
         << "Sector " << sector << " anom";
         << "Sector " << sector << " anom";
-    EXPECT_EQ(dir.galaxy.meta["density"][sector_text]["known"],
+    EXPECT_EQ(dir.galaxy.meta[D][sector_text]["known"],
               (bool)sector_data[sector]["known"])
               (bool)sector_data[sector]["known"])
         << "Sector " << sector << " known";
         << "Sector " << sector << " known";
   }
   }