From 3c068364ee54e21307fe13522647733adc2d83e4 Mon Sep 17 00:00:00 2001
From: yboucher <yann.boucher@etu.utc.fr>
Date: Sat, 12 Jun 2021 11:29:03 +0200
Subject: [PATCH] Suppression des warnings

---
 forms/neighborhoodDialog.ui              |  4 +--
 include/neighborhoodrule.hpp             |  2 +-
 src/structurelibraryview.cpp             |  1 -
 tests/arbitraryneighborhoodrule_test.cpp |  2 +-
 tests/circulartransition_test.cpp        |  8 ++---
 tests/grid_test.cpp                      |  2 +-
 tests/history_test.cpp                   |  8 ++---
 tests/lifegametransition_test.cpp        | 10 +++---
 tests/mooreNeighborhoodRule_test.cpp     | 12 +++----
 tests/mooreVonNeumann_test.cpp           |  8 ++---
 tests/nonisotropictransition_test.cpp    | 16 +++++-----
 tests/property_test.cpp                  |  2 +-
 tests/structure_test.cpp                 |  8 ++---
 tests/structurereader_tests.cpp          |  8 ++---
 tests/totalistictransition_test.cpp      | 40 ++++++++++++------------
 15 files changed, 65 insertions(+), 66 deletions(-)

diff --git a/forms/neighborhoodDialog.ui b/forms/neighborhoodDialog.ui
index 7232c50..e36028f 100644
--- a/forms/neighborhoodDialog.ui
+++ b/forms/neighborhoodDialog.ui
@@ -63,7 +63,7 @@
             <string>Width :</string>
            </property>
            <property name="buddy">
-            <cstring>widthSpinBox</cstring>
+            <cstring>widthSpinBox_2</cstring>
            </property>
           </widget>
          </item>
@@ -86,7 +86,7 @@
             <string>Height :</string>
            </property>
            <property name="buddy">
-            <cstring>heightSpinBox</cstring>
+            <cstring>heightSpinBox_2</cstring>
            </property>
           </widget>
          </item>
diff --git a/include/neighborhoodrule.hpp b/include/neighborhoodrule.hpp
index 97ae842..01a57ba 100644
--- a/include/neighborhoodrule.hpp
+++ b/include/neighborhoodrule.hpp
@@ -49,7 +49,7 @@ public:
     //! \brief Change le numéro de génération de la règle de voisinage d'une génération
     //! Fait avancer ou reculer l'état de la règle de voisinage d'une génération. Cette fonction est utilisée pour les voisinages tels que celui de Margolus, qui dépendent de la parité de la génération actuelle.
     //! \remark L'implémentation par défaut ne fait rien.
-    virtual void update_generation(unsigned gen) {}
+    virtual void update_generation(unsigned gen) { (void)gen; }
 };
 
 #endif // NEIGHBORHOODRULE_HPP
diff --git a/src/structurelibraryview.cpp b/src/structurelibraryview.cpp
index 7314f11..2ae234f 100644
--- a/src/structurelibraryview.cpp
+++ b/src/structurelibraryview.cpp
@@ -126,7 +126,6 @@ void StructureLibraryView::update_preview(const Structure &s)
 
 QImage StructureLibraryView::create_preview_image(const Structure &s, bool transparent)
 {
-    stateColor bg = m_alph.getState(0).getColor();
     QImage img(s.width(), s.height(), QImage::Format_ARGB32);
     if (transparent)
         img.fill(Qt::transparent);
diff --git a/tests/arbitraryneighborhoodrule_test.cpp b/tests/arbitraryneighborhoodrule_test.cpp
index 99d58b5..71c5755 100644
--- a/tests/arbitraryneighborhoodrule_test.cpp
+++ b/tests/arbitraryneighborhoodrule_test.cpp
@@ -31,7 +31,7 @@ void CellulutTests::test_arbitrary_neighborhood_rule()
             prop->accept(visit);
     }
 
-    QCOMPARE(rule.getFormats().size(), 1);
+    QCOMPARE(rule.getFormats().size(), 1ul);
     QCOMPARE(rule.getFormats()[0].positions.size(), coords.size());
 
     auto list = rule.getFormats()[0].positions;
diff --git a/tests/circulartransition_test.cpp b/tests/circulartransition_test.cpp
index 1e9f474..609734f 100644
--- a/tests/circulartransition_test.cpp
+++ b/tests/circulartransition_test.cpp
@@ -24,7 +24,7 @@ void CellulutTests::test_circulartransition()
         n.addNeighbor({1, 0}, 0);
         n.addNeighbor({-1, 0}, 1);
 
-        unsigned next = rule.getState(0, n);
+        int next = rule.getState(0, n);
         QCOMPARE(next, 0);
     }
 
@@ -36,7 +36,7 @@ void CellulutTests::test_circulartransition()
         n.addNeighbor({1, 0}, 1);
         n.addNeighbor({-1, 0}, 0);
 
-        unsigned next = rule.getState(0, n);
+        int next = rule.getState(0, n);
         QCOMPARE(next, 1);
     }
 
@@ -48,7 +48,7 @@ void CellulutTests::test_circulartransition()
         n.addNeighbor({1, 0}, 2);
         n.addNeighbor({-1, 0}, 0);
 
-        unsigned next = rule.getState(1, n);
+        int next = rule.getState(1, n);
         QCOMPARE(next, 2);
     }
 
@@ -60,7 +60,7 @@ void CellulutTests::test_circulartransition()
         n.addNeighbor({1, 0}, 0);
         n.addNeighbor({-1, 0}, 0);
 
-        unsigned next = rule.getState(3, n);
+        int next = rule.getState(3, n);
         QCOMPARE(next, 0);
     }
 }
diff --git a/tests/grid_test.cpp b/tests/grid_test.cpp
index 362dc79..74089c4 100644
--- a/tests/grid_test.cpp
+++ b/tests/grid_test.cpp
@@ -13,7 +13,7 @@ void CellulutTests::test_grid()
     grid.set_cell(pos2,10);
     Coord pos3 = {1,2};
     grid.set_cell(pos3,1);
-    unsigned int state = grid.get_state(pos1);
+    int state = grid.get_state(pos1);
     QCOMPARE(state, 2);
     QVERIFY(grid.get_state(pos2) == 10);
     QVERIFY(grid.get_state(pos3) == 1);
diff --git a/tests/history_test.cpp b/tests/history_test.cpp
index 0675502..e919846 100644
--- a/tests/history_test.cpp
+++ b/tests/history_test.cpp
@@ -27,12 +27,12 @@ void CellulutTests::test_history()
 
     // On pop la première grille puis la deuxième
     Grid popGrid = historyTest.popGrid();
-    QCOMPARE(popGrid.get_state(pos2), 3);
+    QCOMPARE(popGrid.get_state(pos2), 3ul);
     Grid topGrid = historyTest.topGrid();
     QVERIFY(topGrid.get_state(pos1) == 2);
 
     popGrid = historyTest.popGrid();
-    QCOMPARE(popGrid.get_state(pos1), 2);
+    QCOMPARE(popGrid.get_state(pos1), 2ul);
     QVERIFY(historyTest.isEmpty() == true);
 
     // Push de trois grille (taille max de la pile de l'history = 2)
@@ -41,11 +41,11 @@ void CellulutTests::test_history()
     historyTest.pushGrid(gridTest3); // La première grille est supprimée
 
     popGrid = historyTest.popGrid();
-    QCOMPARE(popGrid.get_state(pos3), 4);
+    QCOMPARE(popGrid.get_state(pos3), 4ul);
     topGrid = historyTest.topGrid();
     QVERIFY(topGrid.get_state(pos2) == 3);
 
     popGrid = historyTest.popGrid();
-    QCOMPARE(popGrid.get_state(pos2), 3);
+    QCOMPARE(popGrid.get_state(pos2), 3ul);
     QVERIFY(historyTest.isEmpty() == true);
 }
diff --git a/tests/lifegametransition_test.cpp b/tests/lifegametransition_test.cpp
index af7b353..d9fe463 100644
--- a/tests/lifegametransition_test.cpp
+++ b/tests/lifegametransition_test.cpp
@@ -14,7 +14,7 @@ void CellulutTests::test_lifegametransition()
         n.addNeighbor({1, 0}, 0);
         n.addNeighbor({-1, 0}, 1);
 
-        unsigned next = rule.getState(0, n);
+        int next = rule.getState(0, n);
         QCOMPARE(next, 0);
     }
 
@@ -26,7 +26,7 @@ void CellulutTests::test_lifegametransition()
         n.addNeighbor({1, 0}, 0);
         n.addNeighbor({-1, 0}, 1);
 
-        unsigned next = rule.getState(0, n);
+        int next = rule.getState(0, n);
         QCOMPARE(next, 1);
     }
 
@@ -38,7 +38,7 @@ void CellulutTests::test_lifegametransition()
         n.addNeighbor({1, 0}, 0);
         n.addNeighbor({-1, 0}, 0);
 
-        unsigned next = rule.getState(1, n);
+        int next = rule.getState(1, n);
         QCOMPARE(next, 1);
     }
 
@@ -51,7 +51,7 @@ void CellulutTests::test_lifegametransition()
         n.addNeighbor({-1, 0}, 1);
         n.addNeighbor({-1, -1}, 1);
 
-        unsigned next = rule.getState(1, n);
+        int next = rule.getState(1, n);
         QCOMPARE(next, 0);
     }
 
@@ -63,7 +63,7 @@ void CellulutTests::test_lifegametransition()
         n.addNeighbor({1, 0}, 1);
         n.addNeighbor({-1, 0}, 0);
 
-        unsigned next = rule.getState(1, n);
+        int next = rule.getState(1, n);
         QCOMPARE(next, 0);
     }
 }
diff --git a/tests/mooreNeighborhoodRule_test.cpp b/tests/mooreNeighborhoodRule_test.cpp
index 7e528f6..4362c34 100644
--- a/tests/mooreNeighborhoodRule_test.cpp
+++ b/tests/mooreNeighborhoodRule_test.cpp
@@ -52,12 +52,12 @@ void CellulutTests::test_mooreNeighborhoodRule() {
         prop->accept(visit);
 
     Neighborhood v=newMoore.getNeighborhood(g,cellule);
-    unsigned int nb_voi=v.getNb(3);
-    unsigned int nb_voi2=v.getNb(5);
-    unsigned int nb_voi3=v.getNb(2);
-    unsigned int nb_voi4=v.getNb(8);
-    unsigned int nb_voi5=v.getNb(7);
-    unsigned int nb_voi6=v.getNb(4);
+    int nb_voi=v.getNb(3);
+    int nb_voi2=v.getNb(5);
+    int nb_voi3=v.getNb(2);
+    int nb_voi4=v.getNb(8);
+    int nb_voi5=v.getNb(7);
+    int nb_voi6=v.getNb(4);
 
     QCOMPARE(nb_voi,2);
     QCOMPARE(nb_voi2,2);
diff --git a/tests/mooreVonNeumann_test.cpp b/tests/mooreVonNeumann_test.cpp
index 2d95741..7a0a633 100644
--- a/tests/mooreVonNeumann_test.cpp
+++ b/tests/mooreVonNeumann_test.cpp
@@ -19,10 +19,10 @@ void CellulutTests::test_VonNeumann(){
 
     vonNeumannNeighborhoodRule voi(1);
     Neighborhood v=voi.getNeighborhood(g,cellule);
-    unsigned int nb_voi=v.getNb(3);
-    unsigned int nb_voi2=v.getNb(5);
-    unsigned int nb_voi3=v.getNb(2);
-    unsigned int nb_voi4=v.getNb(8);
+    int nb_voi=v.getNb(3);
+    int nb_voi2=v.getNb(5);
+    int nb_voi3=v.getNb(2);
+    int nb_voi4=v.getNb(8);
     QCOMPARE(nb_voi,2);
     QCOMPARE(nb_voi2,1);
     QCOMPARE(nb_voi3,1);
diff --git a/tests/nonisotropictransition_test.cpp b/tests/nonisotropictransition_test.cpp
index aa3a2c8..41cecb6 100644
--- a/tests/nonisotropictransition_test.cpp
+++ b/tests/nonisotropictransition_test.cpp
@@ -18,7 +18,7 @@ void CellulutTests::test_nonisotropictransition()
         unsigned next = 0;
         bool accepted = entry.accept(0, neighborhood, next);
         QVERIFY(accepted);
-        QCOMPARE(next, 1);
+        QCOMPARE(next, 1u);
     }
 
     {
@@ -46,7 +46,7 @@ void CellulutTests::test_nonisotropictransition()
         unsigned next = 0;
         bool accepted = entry.accept(0, neighborhood, next);
         QVERIFY(accepted);
-        QCOMPARE(next, 1);
+        QCOMPARE(next, 1u);
     }
 
     {
@@ -73,7 +73,7 @@ void CellulutTests::test_nonisotropictransition()
         unsigned next = 0;
         bool accepted = entry.accept(0, neighborhood, next);
         QVERIFY(accepted);
-        QCOMPARE(next, 1);
+        QCOMPARE(next, 1u);
     }
 
     {
@@ -93,7 +93,7 @@ void CellulutTests::test_nonisotropictransition()
             neighborhood.addNeighbor({0, -1}, 1); // index 0
             neighborhood.addNeighbor({-1, 0}, 0); // index 1
             unsigned next = rule.getState(0, neighborhood);
-            QCOMPARE(next, 1);
+            QCOMPARE(next, 1u);
         }
 
         {
@@ -103,7 +103,7 @@ void CellulutTests::test_nonisotropictransition()
             neighborhood.addNeighbor({0, -1}, 0); // index 0
             neighborhood.addNeighbor({-1, 0}, 1); // index 1
             unsigned next = rule.getState(0, neighborhood);
-            QCOMPARE(next, 1);
+            QCOMPARE(next, 1u);
         }
         {
             Neighborhood neighborhood;
@@ -112,7 +112,7 @@ void CellulutTests::test_nonisotropictransition()
             neighborhood.addNeighbor({0, -1}, 0); // index 0
             neighborhood.addNeighbor({-1, 0}, 0); // index 1
             unsigned next = rule.getState(0, neighborhood);
-            QCOMPARE(next, 1);
+            QCOMPARE(next, 1u);
         }
         {
             Neighborhood neighborhood;
@@ -121,7 +121,7 @@ void CellulutTests::test_nonisotropictransition()
             neighborhood.addNeighbor({0, -1}, 0); // index 0
             neighborhood.addNeighbor({-1, 0}, 0); // index 1
             unsigned next = rule.getState(0, neighborhood);
-            QCOMPARE(next, 1);
+            QCOMPARE(next, 1u);
         }
         {
             Neighborhood neighborhood;
@@ -130,7 +130,7 @@ void CellulutTests::test_nonisotropictransition()
             neighborhood.addNeighbor({0, -1}, 1); // index 0
             neighborhood.addNeighbor({-1, 0}, 0); // index 1
             unsigned next = rule.getState(0, neighborhood);
-            QCOMPARE(next, 0);
+            QCOMPARE(next, 0u);
         }
     }
 }
diff --git a/tests/property_test.cpp b/tests/property_test.cpp
index bc8a338..4761801 100644
--- a/tests/property_test.cpp
+++ b/tests/property_test.cpp
@@ -28,7 +28,7 @@ void CellulutTests::test_property()
 
     test.coords.load_from_neighborhood(n);
 
-    QCOMPARE(test.coords.size(), 3);
+    QCOMPARE(test.coords.size(), 3ul);
     for (unsigned i = 0; i < test.coords.size(); ++i)
     {
         CoordinateProperty& coord = static_cast<CoordinateProperty&>(test.coords.at(i));
diff --git a/tests/structure_test.cpp b/tests/structure_test.cpp
index 3f8cf73..6c95dc6 100644
--- a/tests/structure_test.cpp
+++ b/tests/structure_test.cpp
@@ -24,8 +24,8 @@ void CellulutTests::test_structure()
         QVERIFY(std::is_permutation(normalized_coords.begin(), normalized_coords.end(), s1.begin()));
         QVERIFY(std::is_permutation(normalized_coords.begin(), normalized_coords.end(), s2.begin()));
 
-        QCOMPARE(s1.width(), 3);
-        QCOMPARE(s1.height(), 2);
+        QCOMPARE(s1.width(), 3ul);
+        QCOMPARE(s1.height(), 2ul);
 
         s1.load(empty.begin(), empty.end());
         QVERIFY(s1.size() == 0);
@@ -40,8 +40,8 @@ void CellulutTests::test_structure()
         QCOMPARE(s1.size(), coords.size()); // 2 cellules non nulles, on ignore les cellules à zéro qui sont toujours implicites
         QVERIFY(std::is_permutation(normalized_coords.begin(), normalized_coords.end(), s1.begin()));
 
-        QCOMPARE(s1.width(), 3);
-        QCOMPARE(s1.height(), 2);
+        QCOMPARE(s1.width(), 3ul);
+        QCOMPARE(s1.height(), 2ul);
     }
 }
 
diff --git a/tests/structurereader_tests.cpp b/tests/structurereader_tests.cpp
index 7745062..84b55c2 100644
--- a/tests/structurereader_tests.cpp
+++ b/tests/structurereader_tests.cpp
@@ -39,7 +39,7 @@ void CellulutTests::test_rle_structurereader()
 
         try {
             Structure stru = rle.read_structure();
-            QCOMPARE(stru.size(), 5);
+            QCOMPARE(stru.size(), 5ul);
             QVERIFY(std::count(stru.begin(), stru.end(), std::make_pair<Coord, unsigned>(Coord{1, 0}, 1)) == 1);
         }
         catch (const std::exception& ex)
@@ -55,7 +55,7 @@ void CellulutTests::test_rle_structurereader()
         try {
 
             Structure stru = rle.read_structure();
-            QCOMPARE(stru.size(), 36);
+            QCOMPARE(stru.size(), 36ul);
         }
         catch (const std::exception& ex)
         {
@@ -70,7 +70,7 @@ void CellulutTests::test_rle_structurereader()
         try {
 
             Structure stru = rle.read_structure();
-            QCOMPARE(stru.size(), 16);
+            QCOMPARE(stru.size(), 16ul);
 
             std::map<int, int> state_count;
             for (auto pair : stru)
@@ -96,7 +96,7 @@ void CellulutTests::test_json_structurereader()
 
         try {
             Structure stru = rle.read_structure();
-            QCOMPARE(stru.size(), 2);
+            QCOMPARE(stru.size(), 2ul);
             QVERIFY(std::count(stru.begin(), stru.end(), std::make_pair<Coord, unsigned>(Coord{0, 0}, 1)) == 1);
             QVERIFY(std::count(stru.begin(), stru.end(), std::make_pair<Coord, unsigned>(Coord{2, 3}, 3)) == 1);
         }
diff --git a/tests/totalistictransition_test.cpp b/tests/totalistictransition_test.cpp
index a0540f3..98483b1 100644
--- a/tests/totalistictransition_test.cpp
+++ b/tests/totalistictransition_test.cpp
@@ -28,7 +28,7 @@ void CellulutTests::test_totalistictransition()
         unsigned next = 0;
         bool accepted = entry.accept(0, neighborhood, next);
         QVERIFY(accepted);
-        QCOMPARE(next, 1);
+        QCOMPARE(next, 1u);
     }
 
     {
@@ -42,7 +42,7 @@ void CellulutTests::test_totalistictransition()
         unsigned next = 0;
         bool accepted = entry.accept(1, neighborhood, next);
         QVERIFY(accepted);
-        QCOMPARE(next, 2);
+        QCOMPARE(next, 2u);
     }
 
     {
@@ -56,7 +56,7 @@ void CellulutTests::test_totalistictransition()
         unsigned next = 0;
         bool accepted = entry.accept(2, neighborhood, next);
         QVERIFY(accepted);
-        QCOMPARE(next, 0);
+        QCOMPARE(next, 0u);
     }
 
     {
@@ -83,7 +83,7 @@ void CellulutTests::test_totalistictransition()
         unsigned next = 1;
         bool accepted = entry.accept(1, neighborhood, next);
         QVERIFY(accepted);
-        QCOMPARE(next, 0);
+        QCOMPARE(next, 0u);
     }
 
     {
@@ -104,13 +104,13 @@ void CellulutTests::test_totalistictransition()
             neighborhood.addNeighbor({0, -1}, 1);
             neighborhood.addNeighbor({-1, 0}, 2);
             unsigned next = rule.getState(0, neighborhood);
-            QCOMPARE(next, 0);
+            QCOMPARE(next, 0u);
             next = rule.getState(1, neighborhood);
-            QCOMPARE(next, 2);
+            QCOMPARE(next, 2u);
             next = rule.getState(2, neighborhood);
-            QCOMPARE(next, 3);
+            QCOMPARE(next, 3u);
             next = rule.getState(3, neighborhood);
-            QCOMPARE(next, 1);
+            QCOMPARE(next, 1u);
         }
 
         {
@@ -120,13 +120,13 @@ void CellulutTests::test_totalistictransition()
             neighborhood.addNeighbor({0, -1}, 1);
             neighborhood.addNeighbor({-1, 0}, 1);
             unsigned next = rule.getState(0, neighborhood);
-            QCOMPARE(next, 0);
+            QCOMPARE(next, 0u);
             next = rule.getState(1, neighborhood);
-            QCOMPARE(next, 2);
+            QCOMPARE(next, 2u);
             next = rule.getState(2, neighborhood);
-            QCOMPARE(next, 3);
+            QCOMPARE(next, 3u);
             next = rule.getState(3, neighborhood);
-            QCOMPARE(next, 3);
+            QCOMPARE(next, 3u);
         }
     }
 
@@ -148,9 +148,9 @@ void CellulutTests::test_totalistictransition()
             neighborhood.addNeighbor({0, -1}, 1);
             neighborhood.addNeighbor({-1, 0}, 1);
             unsigned next = rule.getState(0, neighborhood);
-            QCOMPARE(next, 1);
+            QCOMPARE(next, 1u);
             next = rule.getState(1, neighborhood);
-            QCOMPARE(next, 1);
+            QCOMPARE(next, 1u);
         }
 
         {
@@ -160,9 +160,9 @@ void CellulutTests::test_totalistictransition()
             neighborhood.addNeighbor({0, -1}, 0);
             neighborhood.addNeighbor({-1, 0}, 1);
             unsigned next = rule.getState(0, neighborhood);
-            QCOMPARE(next, 0);
+            QCOMPARE(next, 0u);
             next = rule.getState(1, neighborhood);
-            QCOMPARE(next, 1);
+            QCOMPARE(next, 1u);
         }
 
         {
@@ -172,9 +172,9 @@ void CellulutTests::test_totalistictransition()
             neighborhood.addNeighbor({0, -1}, 0);
             neighborhood.addNeighbor({-1, 0}, 0);
             unsigned next = rule.getState(0, neighborhood);
-            QCOMPARE(next, 0);
+            QCOMPARE(next, 0u);
             next = rule.getState(1, neighborhood);
-            QCOMPARE(next, 0);
+            QCOMPARE(next, 0u);
         }
 
         {
@@ -184,9 +184,9 @@ void CellulutTests::test_totalistictransition()
             neighborhood.addNeighbor({0, -1}, 1);
             neighborhood.addNeighbor({-1, 0}, 1);
             unsigned next = rule.getState(0, neighborhood);
-            QCOMPARE(next, 0);
+            QCOMPARE(next, 0u);
             next = rule.getState(1, neighborhood);
-            QCOMPARE(next, 0);
+            QCOMPARE(next, 0u);
         }
     }
 }
-- 
GitLab