Dogeku 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +39 -0
- data/app/Historique/Action.rb +29 -0
- data/app/Historique/ChangerCase.rb +44 -0
- data/app/Historique/HistoriqueAction.rb +114 -0
- data/app/components/CaseDessin.rb +325 -0
- data/app/components/GrilleDessin.rb +235 -0
- data/app/components/Header.rb +194 -0
- data/app/config/app.yml +0 -0
- data/app/config/database.yml +2 -0
- data/app/controller/ApprentissageControleur.rb +75 -0
- data/app/controller/ChargerControleur.rb +41 -0
- data/app/controller/JeuLibreControleur.rb +244 -0
- data/app/controller/MenuControleur.rb +57 -0
- data/app/controller/NiveauControleur.rb +54 -0
- data/app/controller/NouvellePartieControleur.rb +34 -0
- data/app/controller/PrincipaleControleur.rb +30 -0
- data/app/controller/PseudoControleur.rb +95 -0
- data/app/controller/ReglagesControleur.rb +86 -0
- data/app/controller/ReglesControleur.rb +34 -0
- data/app/controller/ScoresControleur.rb +42 -0
- data/app/controller/StatistiquesControleur.rb +64 -0
- data/app/core/Conf.rb +26 -0
- data/app/core/Controller.rb +180 -0
- data/app/core/Core.rb +186 -0
- data/app/core/Model.rb +159 -0
- data/app/core/View.rb +56 -0
- data/app/db/main.sqlite3 +0 -0
- data/app/model/Configuration.rb +180 -0
- data/app/model/Grille.rb +180 -0
- data/app/model/Jeu.rb +74 -0
- data/app/model/Score.rb +100 -0
- data/app/model/Utilisateur.rb +113 -0
- data/app/utils/DSubset.rb +98 -0
- data/app/utils/Generateur.rb +171 -0
- data/app/utils/HPTriple.rb +75 -0
- data/app/utils/Peche.rb +46 -0
- data/app/utils/SCandidate.rb +86 -0
- data/app/utils/SCell.rb +73 -0
- data/app/utils/Technique.rb +202 -0
- data/app/utils/TechniqueUsine.rb +25 -0
- data/app/utils/XWing.rb +203 -0
- data/app/view/Fenetre.rb +424 -0
- data/app/view/FenetreApprentissage.rb +272 -0
- data/app/view/FenetreCharger.rb +31 -0
- data/app/view/FenetreJeuLibre.rb +468 -0
- data/app/view/FenetreMenu.rb +198 -0
- data/app/view/FenetreNiveau.rb +105 -0
- data/app/view/FenetreNouvellePartie.rb +92 -0
- data/app/view/FenetrePrincipale.rb +45 -0
- data/app/view/FenetrePseudo.rb +115 -0
- data/app/view/FenetreReglages.rb +209 -0
- data/app/view/FenetreRegles.rb +111 -0
- data/app/view/FenetreScores.rb +120 -0
- data/app/view/FenetreStatistiques.rb +134 -0
- data/assets/css/style.css +69 -0
- data/assets/img/eraser.png +0 -0
- data/assets/img/fond.jpg +0 -0
- data/assets/img/iconApp.png +0 -0
- data/assets/img/logoS.jpeg +0 -0
- data/assets/img/sudokuIntro.jpg +0 -0
- data/assets/img/user.png +0 -0
- data/bin/dogeku +19 -0
- data/doc/Action.html +309 -0
- data/doc/ApprentissageControleur.html +568 -0
- data/doc/CaseDessin.html +2405 -0
- data/doc/ChangerCase.html +405 -0
- data/doc/ChargerControleur.html +342 -0
- data/doc/Conf.html +378 -0
- data/doc/Configuration.html +1115 -0
- data/doc/Controller.html +1008 -0
- data/doc/Core.html +1191 -0
- data/doc/DSubset.html +647 -0
- data/doc/Fenetre.html +2631 -0
- data/doc/FenetreApprentissage.html +1175 -0
- data/doc/FenetreCharger.html +343 -0
- data/doc/FenetreJeuLibre.html +1859 -0
- data/doc/FenetreMenu.html +900 -0
- data/doc/FenetreNiveau.html +626 -0
- data/doc/FenetreNouvellePartie.html +602 -0
- data/doc/FenetrePrincipale.html +371 -0
- data/doc/FenetrePseudo.html +695 -0
- data/doc/FenetreReglages.html +946 -0
- data/doc/FenetreRegles.html +636 -0
- data/doc/FenetreScores.html +650 -0
- data/doc/FenetreStatistiques.html +672 -0
- data/doc/Generateur.html +1015 -0
- data/doc/Grille.html +1348 -0
- data/doc/GrilleDessin.html +1281 -0
- data/doc/HPTriple.html +593 -0
- data/doc/Header.html +1253 -0
- data/doc/HistoriqueAction.html +792 -0
- data/doc/Jeu.html +923 -0
- data/doc/JeuLibreControleur.html +1445 -0
- data/doc/MenuControleur.html +522 -0
- data/doc/Model.html +996 -0
- data/doc/NiveauControleur.html +451 -0
- data/doc/NouvellePartieControleur.html +330 -0
- data/doc/Peche.html +396 -0
- data/doc/PrincipaleControleur.html +320 -0
- data/doc/PseudoControleur.html +695 -0
- data/doc/ReglagesControleur.html +747 -0
- data/doc/ReglesControleur.html +330 -0
- data/doc/SCandidate.html +617 -0
- data/doc/SCell.html +587 -0
- data/doc/Score.html +926 -0
- data/doc/ScoresControleur.html +346 -0
- data/doc/StatistiquesControleur.html +390 -0
- data/doc/Technique.html +543 -0
- data/doc/TechniqueUsine.html +252 -0
- data/doc/Utilisateur.html +806 -0
- data/doc/View.html +844 -0
- data/doc/XWing.html +1031 -0
- data/doc/_index.html +478 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +492 -0
- data/doc/file.README.html +141 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +141 -0
- data/doc/js/app.js +243 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +2523 -0
- data/doc/top-level-namespace.html +112 -0
- data/test/Generateur/grilleCorrecte.rb +198 -0
- data/test/Model/scoreCorrecte.rb +55 -0
- data/test/Model/utilisateurCorrecte.rb +68 -0
- data/test/test_helper.rb +2 -0
- data/test/unitTest.rb +72 -0
- metadata +187 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>
|
|
7
|
+
Top Level Namespace
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.9.8
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
pathId = "";
|
|
19
|
+
relpath = '';
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
|
24
|
+
|
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<div class="nav_wrap">
|
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
|
32
|
+
<div id="resizer"></div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div id="main" tabindex="-1">
|
|
36
|
+
<div id="header">
|
|
37
|
+
<div id="menu">
|
|
38
|
+
|
|
39
|
+
<a href="_index.html">Index</a> »
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<span class="title">Top Level Namespace</span>
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div id="search">
|
|
47
|
+
|
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
|
49
|
+
href="class_list.html">
|
|
50
|
+
|
|
51
|
+
<svg width="24" height="24">
|
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
|
55
|
+
</svg>
|
|
56
|
+
</a>
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
<div class="clear"></div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div id="content"><h1>Top Level Namespace
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</h1>
|
|
67
|
+
<div class="box_info">
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<h2>Defined Under Namespace</h2>
|
|
82
|
+
<p class="children">
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Core.html" title="Core (module)">Core</a></span>, <span class='object_link'><a href="Fenetre.html" title="Fenetre (module)">Fenetre</a></span>, <span class='object_link'><a href="Header.html" title="Header (module)">Header</a></span>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Action.html" title="Action (class)">Action</a></span>, <span class='object_link'><a href="ApprentissageControleur.html" title="ApprentissageControleur (class)">ApprentissageControleur</a></span>, <span class='object_link'><a href="CaseDessin.html" title="CaseDessin (class)">CaseDessin</a></span>, <span class='object_link'><a href="ChangerCase.html" title="ChangerCase (class)">ChangerCase</a></span>, <span class='object_link'><a href="ChargerControleur.html" title="ChargerControleur (class)">ChargerControleur</a></span>, <span class='object_link'><a href="Conf.html" title="Conf (class)">Conf</a></span>, <span class='object_link'><a href="Configuration.html" title="Configuration (class)">Configuration</a></span>, <span class='object_link'><a href="Controller.html" title="Controller (class)">Controller</a></span>, <span class='object_link'><a href="DSubset.html" title="DSubset (class)">DSubset</a></span>, <span class='object_link'><a href="FenetreApprentissage.html" title="FenetreApprentissage (class)">FenetreApprentissage</a></span>, <span class='object_link'><a href="FenetreCharger.html" title="FenetreCharger (class)">FenetreCharger</a></span>, <span class='object_link'><a href="FenetreJeuLibre.html" title="FenetreJeuLibre (class)">FenetreJeuLibre</a></span>, <span class='object_link'><a href="FenetreMenu.html" title="FenetreMenu (class)">FenetreMenu</a></span>, <span class='object_link'><a href="FenetreNiveau.html" title="FenetreNiveau (class)">FenetreNiveau</a></span>, <span class='object_link'><a href="FenetreNouvellePartie.html" title="FenetreNouvellePartie (class)">FenetreNouvellePartie</a></span>, <span class='object_link'><a href="FenetrePrincipale.html" title="FenetrePrincipale (class)">FenetrePrincipale</a></span>, <span class='object_link'><a href="FenetrePseudo.html" title="FenetrePseudo (class)">FenetrePseudo</a></span>, <span class='object_link'><a href="FenetreReglages.html" title="FenetreReglages (class)">FenetreReglages</a></span>, <span class='object_link'><a href="FenetreRegles.html" title="FenetreRegles (class)">FenetreRegles</a></span>, <span class='object_link'><a href="FenetreScores.html" title="FenetreScores (class)">FenetreScores</a></span>, <span class='object_link'><a href="FenetreStatistiques.html" title="FenetreStatistiques (class)">FenetreStatistiques</a></span>, <span class='object_link'><a href="Generateur.html" title="Generateur (class)">Generateur</a></span>, <span class='object_link'><a href="Grille.html" title="Grille (class)">Grille</a></span>, <span class='object_link'><a href="GrilleDessin.html" title="GrilleDessin (class)">GrilleDessin</a></span>, <span class='object_link'><a href="HPTriple.html" title="HPTriple (class)">HPTriple</a></span>, <span class='object_link'><a href="HistoriqueAction.html" title="HistoriqueAction (class)">HistoriqueAction</a></span>, <span class='object_link'><a href="Jeu.html" title="Jeu (class)">Jeu</a></span>, <span class='object_link'><a href="JeuLibreControleur.html" title="JeuLibreControleur (class)">JeuLibreControleur</a></span>, <span class='object_link'><a href="MenuControleur.html" title="MenuControleur (class)">MenuControleur</a></span>, <span class='object_link'><a href="Model.html" title="Model (class)">Model</a></span>, <span class='object_link'><a href="NiveauControleur.html" title="NiveauControleur (class)">NiveauControleur</a></span>, <span class='object_link'><a href="NouvellePartieControleur.html" title="NouvellePartieControleur (class)">NouvellePartieControleur</a></span>, <span class='object_link'><a href="Peche.html" title="Peche (class)">Peche</a></span>, <span class='object_link'><a href="PrincipaleControleur.html" title="PrincipaleControleur (class)">PrincipaleControleur</a></span>, <span class='object_link'><a href="PseudoControleur.html" title="PseudoControleur (class)">PseudoControleur</a></span>, <span class='object_link'><a href="ReglagesControleur.html" title="ReglagesControleur (class)">ReglagesControleur</a></span>, <span class='object_link'><a href="ReglesControleur.html" title="ReglesControleur (class)">ReglesControleur</a></span>, <span class='object_link'><a href="SCandidate.html" title="SCandidate (class)">SCandidate</a></span>, <span class='object_link'><a href="SCell.html" title="SCell (class)">SCell</a></span>, <span class='object_link'><a href="Score.html" title="Score (class)">Score</a></span>, <span class='object_link'><a href="ScoresControleur.html" title="ScoresControleur (class)">ScoresControleur</a></span>, <span class='object_link'><a href="StatistiquesControleur.html" title="StatistiquesControleur (class)">StatistiquesControleur</a></span>, <span class='object_link'><a href="Technique.html" title="Technique (class)">Technique</a></span>, <span class='object_link'><a href="TechniqueUsine.html" title="TechniqueUsine (class)">TechniqueUsine</a></span>, <span class='object_link'><a href="Utilisateur.html" title="Utilisateur (class)">Utilisateur</a></span>, <span class='object_link'><a href="View.html" title="View (class)">View</a></span>, <span class='object_link'><a href="XWing.html" title="XWing (class)">XWing</a></span>
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
</p>
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<div id="footer">
|
|
105
|
+
Generated on Sat Apr 22 22:47:30 2017 by
|
|
106
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
107
|
+
0.9.8 (ruby-2.3.3).
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
</div>
|
|
111
|
+
</body>
|
|
112
|
+
</html>
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
require_relative '../../app/utils/Generateur'
|
|
2
|
+
|
|
3
|
+
# Author:: BastienMor
|
|
4
|
+
# Developers: BastienMor
|
|
5
|
+
# Version:: 0.1
|
|
6
|
+
# Copyright:: © 2017
|
|
7
|
+
# License:: Distributes under the same terms as Ruby
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
##
|
|
11
|
+
## Classe de test unitaire du générateur de grille.
|
|
12
|
+
##
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
##
|
|
16
|
+
## Vérifie que chaque valeur est correcte
|
|
17
|
+
##
|
|
18
|
+
## @param grid La grille du sudoku
|
|
19
|
+
##
|
|
20
|
+
## @return true si les valeurs sont bonnes, false sinon.
|
|
21
|
+
##
|
|
22
|
+
def checkValues(grid)
|
|
23
|
+
|
|
24
|
+
grid.each do |line|
|
|
25
|
+
line.each do |value|
|
|
26
|
+
if(value<1 || 9<value)
|
|
27
|
+
return false
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
return true
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
##
|
|
37
|
+
## Vérifie que chaque ligne est correcte
|
|
38
|
+
##
|
|
39
|
+
## @param grid La grille du sudoku
|
|
40
|
+
##
|
|
41
|
+
## @return true si la ligne est valide, false sinon.
|
|
42
|
+
##
|
|
43
|
+
def checkLine(grid)
|
|
44
|
+
|
|
45
|
+
0.upto(8){ |x|
|
|
46
|
+
if(grid[x].uniq().count() != 9)
|
|
47
|
+
return false
|
|
48
|
+
end
|
|
49
|
+
}
|
|
50
|
+
return true
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
##
|
|
55
|
+
## Consulte une colonne
|
|
56
|
+
##
|
|
57
|
+
## @param grid La grille de sudoku
|
|
58
|
+
## @param n Le numéro de colonne
|
|
59
|
+
##
|
|
60
|
+
## @return une colonne sous forme d'une liste.
|
|
61
|
+
##
|
|
62
|
+
def gridCol(grid, n)
|
|
63
|
+
|
|
64
|
+
col = Array.new()
|
|
65
|
+
|
|
66
|
+
0.upto(8){ |x|
|
|
67
|
+
col.push(grid[x][n])
|
|
68
|
+
}
|
|
69
|
+
return col
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
##
|
|
74
|
+
## Vérifie que chaque colone est correcte
|
|
75
|
+
##
|
|
76
|
+
## @param grid la grille de sudoku
|
|
77
|
+
##
|
|
78
|
+
## @return true si la colonne est valide, false sinon.
|
|
79
|
+
##
|
|
80
|
+
|
|
81
|
+
def checkCol(grid)
|
|
82
|
+
|
|
83
|
+
0.upto(8){ |x|
|
|
84
|
+
if(gridCol(grid, x).uniq().count() != 9)
|
|
85
|
+
return false
|
|
86
|
+
end
|
|
87
|
+
}
|
|
88
|
+
return true
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
##
|
|
93
|
+
## Consulte un bloc de 3x3 (=région)
|
|
94
|
+
##
|
|
95
|
+
## @param grid La grille de sudoku
|
|
96
|
+
## @param x Coordonnée x du bloc
|
|
97
|
+
## @param y Coordonnée y du bloc
|
|
98
|
+
##
|
|
99
|
+
## @return un bloc sous forme d'une liste.
|
|
100
|
+
##
|
|
101
|
+
def gridBloc(grid, x, y)
|
|
102
|
+
bloc = Array.new()
|
|
103
|
+
|
|
104
|
+
0.upto(2){ |i|
|
|
105
|
+
0.upto(2){ |j|
|
|
106
|
+
bloc.push(grid[3*x+i][3*y+j])
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return bloc
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
##
|
|
114
|
+
## Vérifie que chaque bloc est correcte.
|
|
115
|
+
##
|
|
116
|
+
## @param grid la grille de sudoku
|
|
117
|
+
##
|
|
118
|
+
## @return true si les blocs sont valides, false sinon.
|
|
119
|
+
##
|
|
120
|
+
def checkBloc(grid)
|
|
121
|
+
|
|
122
|
+
0.upto(2){ |x|
|
|
123
|
+
0.upto(2){ |y|
|
|
124
|
+
if(gridBloc(grid, x, y).uniq().count() != 9)
|
|
125
|
+
return false
|
|
126
|
+
end
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return true
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
##
|
|
134
|
+
## vérifie que chaque valeur est correcte.
|
|
135
|
+
##
|
|
136
|
+
## @param grid la grille de sudoku
|
|
137
|
+
##
|
|
138
|
+
## @return true si les valeurs sont valides, false sinon.
|
|
139
|
+
##
|
|
140
|
+
def checkAllVal(grid)
|
|
141
|
+
|
|
142
|
+
grid.each do |l|
|
|
143
|
+
l.each do |e|
|
|
144
|
+
if (e == nil)
|
|
145
|
+
else
|
|
146
|
+
if (e>0) && (e<10)
|
|
147
|
+
else
|
|
148
|
+
return false
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
return true
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
##
|
|
158
|
+
## Vérifie que chaque valeur est correcte après conversion de la grille.
|
|
159
|
+
##
|
|
160
|
+
## @param grid La grille de sudoku
|
|
161
|
+
##
|
|
162
|
+
## @return true si les valeurs sont valides, false sinon.
|
|
163
|
+
##
|
|
164
|
+
def checkAllValConverted(grid)
|
|
165
|
+
|
|
166
|
+
grid.each do |l|
|
|
167
|
+
l.each do |e|
|
|
168
|
+
if (e['value'] == nil)
|
|
169
|
+
else
|
|
170
|
+
if (e['value']>0) && (e['value']<10)
|
|
171
|
+
else
|
|
172
|
+
return false
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
return true
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
##
|
|
182
|
+
## Méthode de test, génère une grille et teste les lignes, colonnes et régions.
|
|
183
|
+
##
|
|
184
|
+
## @return true si la grille est valide, false sinon.
|
|
185
|
+
##
|
|
186
|
+
def grilleCorrecte()
|
|
187
|
+
|
|
188
|
+
gen = Generateur.new(0)
|
|
189
|
+
|
|
190
|
+
if(!checkAllValConverted(gen.generer()))
|
|
191
|
+
return false
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
puts "All green."
|
|
196
|
+
return true
|
|
197
|
+
end
|
|
198
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# File description
|
|
2
|
+
#
|
|
3
|
+
# Author:: BastienMor
|
|
4
|
+
# Developers: BastienMor
|
|
5
|
+
# Version:: 0.1
|
|
6
|
+
# Copyright:: © 2017
|
|
7
|
+
# License:: Distributes under the same terms as Ruby
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
# Class description
|
|
11
|
+
# Classe de test unitaire du score de la partie.
|
|
12
|
+
|
|
13
|
+
require_relative '../../app/model/Utilisateur'
|
|
14
|
+
require_relative '../../app/model/Score'
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
##
|
|
18
|
+
## Creer un score et le recherche pour vérifié son existance.
|
|
19
|
+
##
|
|
20
|
+
## @param usr l'objet utilisateur et sco l'objet score.
|
|
21
|
+
##
|
|
22
|
+
## @return true si le score a bien été creer, false sinon.
|
|
23
|
+
##
|
|
24
|
+
|
|
25
|
+
def checkCreaScore(usr, sco)
|
|
26
|
+
sco.difficulte = 1
|
|
27
|
+
score = sco.calcul(2, 120)
|
|
28
|
+
sco.creerScore(1, 0, score)
|
|
29
|
+
if (!meilleursScores(1))
|
|
30
|
+
return false
|
|
31
|
+
end
|
|
32
|
+
return true
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
##
|
|
37
|
+
## méthode de test, génère un utilisateur et vérifi que l'on peu creer des scores a lui associé.
|
|
38
|
+
##
|
|
39
|
+
## @return true si le score foncrionne, false sinon.
|
|
40
|
+
##
|
|
41
|
+
def scoreCorrecte()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
usr = Utilisateur.instance()
|
|
45
|
+
sco = Score.instance()
|
|
46
|
+
usr.creerUtilisateur("toto")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
if(!checkCreaScore(usr, sco))
|
|
50
|
+
return false
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
puts "all green"
|
|
54
|
+
return true
|
|
55
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# File description
|
|
2
|
+
#
|
|
3
|
+
# Author:: BastienMor
|
|
4
|
+
# Developers: BastienMor
|
|
5
|
+
# Version:: 0.1
|
|
6
|
+
# Copyright:: © 2017
|
|
7
|
+
# License:: Distributes under the same terms as Ruby
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
# Class description
|
|
11
|
+
# Classe de test unitaire de l'utilisateur.
|
|
12
|
+
require_relative '../../app/model/Utilisateur'
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
##
|
|
17
|
+
## Creer un utilisateur et le recherche pour vérifié son existance.
|
|
18
|
+
##
|
|
19
|
+
## @param usr l'objet utilisateur.
|
|
20
|
+
##
|
|
21
|
+
## @return true si l'utilisateur a bien été creer, false sinon.
|
|
22
|
+
##
|
|
23
|
+
|
|
24
|
+
def checkCreation(usr)
|
|
25
|
+
usr.creerUtilisateur("toto")
|
|
26
|
+
return usr.rechercherUtilisateur("toto")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
##
|
|
31
|
+
## Supprime un utilisateur et le recherche pour vérifié son inexistance.
|
|
32
|
+
##
|
|
33
|
+
## @param usr l'objet utilisateur.
|
|
34
|
+
##
|
|
35
|
+
## @return true si l'utilisateur a bien été supprimer, false sinon.
|
|
36
|
+
##
|
|
37
|
+
|
|
38
|
+
def checkSupression(usr)
|
|
39
|
+
usr.supprimerUtilisateur("toto")
|
|
40
|
+
return !usr.rechercherUtilisateur("toto")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
##
|
|
44
|
+
## méthode de test, génère un utilisateur et vérifi qu'il existe et qu'on peut le supprimer.
|
|
45
|
+
##
|
|
46
|
+
## @return true si l'utilisateur foncrionne, false sinon.
|
|
47
|
+
##
|
|
48
|
+
|
|
49
|
+
def utilisateurCorrecte()
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
usr = Utilisateur.instance()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
if(!checkCreation(usr))
|
|
56
|
+
return false
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
if(!checkSupression(usr))
|
|
60
|
+
return false
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
puts "all green"
|
|
65
|
+
return true
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
|
data/test/test_helper.rb
ADDED
data/test/unitTest.rb
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
|
|
2
|
+
# Author:: DanAurea
|
|
3
|
+
# Developers: DanAurea
|
|
4
|
+
# Version:: 0.1
|
|
5
|
+
# Copyright:: © 2016
|
|
6
|
+
# License:: Distributes under the same terms as Ruby
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
require_relative "../app/core/Core.rb"
|
|
11
|
+
require_relative "../app/core/Model.rb"
|
|
12
|
+
require_relative 'Generateur/grilleCorrecte'
|
|
13
|
+
require_relative 'Model/utilisateurCorrecte'
|
|
14
|
+
require_relative 'Model/scoreCorrecte'
|
|
15
|
+
require 'rspec'
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Classe de test unitaire des différents modules.
|
|
19
|
+
class UnitTest
|
|
20
|
+
|
|
21
|
+
def initialize()
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
##
|
|
27
|
+
## Méthode de test du générateur de grille.
|
|
28
|
+
##
|
|
29
|
+
## @return true si le test est positif, false sinon.
|
|
30
|
+
##
|
|
31
|
+
def UnitTest.testerGrilleCorrecte()
|
|
32
|
+
|
|
33
|
+
grilleCorrecte()
|
|
34
|
+
|
|
35
|
+
RSpec.describe Generateur, "#grille" do
|
|
36
|
+
context "test" do
|
|
37
|
+
it "Generation d'une grille aleatoire" do
|
|
38
|
+
expect(grilleCorrecte()).to eq false
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
##
|
|
46
|
+
## Méthode de test du gestionnaire d'utilisateurs.
|
|
47
|
+
##
|
|
48
|
+
## @return true si le test est positif, false sinon.
|
|
49
|
+
##
|
|
50
|
+
def UnitTest.testerUtilisateurCorrecte()
|
|
51
|
+
return utilisateurCorrecte()
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
##
|
|
56
|
+
## méthode de test de la gestion des scores.
|
|
57
|
+
##
|
|
58
|
+
## @return true si le test est positif, false sinon.
|
|
59
|
+
##
|
|
60
|
+
def UnitTest.testerScoreCorrecte()
|
|
61
|
+
# if(utilisateurCorrecte())
|
|
62
|
+
# scoreCorrecte()
|
|
63
|
+
# else
|
|
64
|
+
# return false
|
|
65
|
+
# end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
puts UnitTest.testerGrilleCorrecte()
|
|
71
|
+
puts UnitTest.testerUtilisateurCorrecte()
|
|
72
|
+
puts UnitTest.testerScoreCorrecte()
|