From 077dcf25b86267886962caeccdde832116a9beda Mon Sep 17 00:00:00 2001 From: massat <massat@91-170-22-77.subs.proxad.net> Date: Wed, 14 Sep 2022 16:07:27 +0200 Subject: [PATCH] Introduction des tests Junit. --- .classpath | 19 ++ .gitignore | 2 + .project | 23 +++ .settings/org.eclipse.buildship.core.prefs | 13 ++ .settings/org.eclipse.jdt.core.prefs | 4 + .../main/elevator/TestAutomaticElevator.class | Bin 0 -> 1401 bytes .../test/elevator/ElevatorSimulatorTest.class | Bin 0 -> 1292 bytes .../elevator.ElevatorSimulatorTest.html | 96 +++++++++ build/reports/tests/test/css/base-style.css | 179 ++++++++++++++++ build/reports/tests/test/css/style.css | 84 ++++++++ build/reports/tests/test/index.html | 133 ++++++++++++ build/reports/tests/test/js/report.js | 194 ++++++++++++++++++ .../reports/tests/test/packages/elevator.html | 103 ++++++++++ .../TEST-elevator.ElevatorSimulatorTest.xml | 7 + build/test-results/test/binary/output.bin | 0 build/test-results/test/binary/output.bin.idx | Bin 0 -> 1 bytes build/test-results/test/binary/results.bin | Bin 0 -> 109 bytes .../compileJava/previous-compilation-data.bin | Bin 0 -> 278 bytes .../previous-compilation-data.bin | Bin 0 -> 2422 bytes .../java/elevator/TestAutomaticElevator.java | 33 --- src/test/java/ElevatorSimulatorTest.java | 2 - .../ElevatorSimulatorTest.java} | 21 +- .../java/elevator/TestAutomaticElevator.java | 41 ++++ 23 files changed, 910 insertions(+), 44 deletions(-) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/org.eclipse.buildship.core.prefs create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 build/classes/java/main/elevator/TestAutomaticElevator.class create mode 100644 build/classes/java/test/elevator/ElevatorSimulatorTest.class create mode 100644 build/reports/tests/test/classes/elevator.ElevatorSimulatorTest.html create mode 100644 build/reports/tests/test/css/base-style.css create mode 100644 build/reports/tests/test/css/style.css create mode 100644 build/reports/tests/test/index.html create mode 100644 build/reports/tests/test/js/report.js create mode 100644 build/reports/tests/test/packages/elevator.html create mode 100644 build/test-results/test/TEST-elevator.ElevatorSimulatorTest.xml create mode 100644 build/test-results/test/binary/output.bin create mode 100644 build/test-results/test/binary/output.bin.idx create mode 100644 build/test-results/test/binary/results.bin create mode 100644 build/tmp/compileJava/previous-compilation-data.bin create mode 100644 build/tmp/compileTestJava/previous-compilation-data.bin delete mode 100644 src/main/java/elevator/TestAutomaticElevator.java delete mode 100644 src/test/java/ElevatorSimulatorTest.java rename src/test/java/{PanelSimulatorTest.java => elevator/ElevatorSimulatorTest.java} (59%) create mode 100644 src/test/java/elevator/TestAutomaticElevator.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..ae30f86 --- /dev/null +++ b/.classpath @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" output="bin/main" path="src/main/java"> + <attributes> + <attribute name="gradle_scope" value="main"/> + <attribute name="gradle_used_by_scope" value="main,test"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="bin/test" path="src/test/java"> + <attributes> + <attribute name="gradle_scope" value="test"/> + <attribute name="gradle_used_by_scope" value="test"/> + <attribute name="test" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/> + <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> + <classpathentry kind="output" path="bin/default"/> +</classpath> diff --git a/.gitignore b/.gitignore index ec27b4b..0cae396 100644 --- a/.gitignore +++ b/.gitignore @@ -70,3 +70,5 @@ fabric.properties .idea/caches/build_file_checksums.ser +/bin/ +/.gradle/ diff --git a/.project b/.project new file mode 100644 index 0000000..7bc7dc0 --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>Elevator</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.buildship.core.gradleprojectbuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.buildship.core.gradleprojectnature</nature> + </natures> +</projectDescription> diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..a40ec5d --- /dev/null +++ b/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,13 @@ +arguments= +auto.sync=false +build.scans.enabled=false +connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) +connection.project.dir= +eclipse.preferences.version=1 +gradle.user.home= +java.home= +jvm.arguments= +offline.mode=false +override.workspace.settings=false +show.console.view=true +show.executions.view=true diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..626e0e1 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.source=17 diff --git a/build/classes/java/main/elevator/TestAutomaticElevator.class b/build/classes/java/main/elevator/TestAutomaticElevator.class new file mode 100644 index 0000000000000000000000000000000000000000..ac45774a43a0783a7f9c715b21d646401c137cf9 GIT binary patch literal 1401 zcmX^0Z`VEs1_oP(Xf6gO24;2!79Ivx1~x_pfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk- z5<5l)W)00Sb_Nbc2C3AX)Uw2q{33l<C?hyCw=@SN!o|SOzy&gkn~{N4!!t@V3?#zK z!@vhJovE|{#1-IS5M&TyWZ+0oEeS43EJ<Z#kkQceft%_HGgbvGYt6|Z!XV1dAjZQW z&LF|aAc0FEBLhoth<^YhgA{JFSQ#K7g^NLkL6)6Cj)y^>K>@|%AsI!fi7AW>ti?I0 zsRfJ-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diff --git a/build/classes/java/test/elevator/ElevatorSimulatorTest.class b/build/classes/java/test/elevator/ElevatorSimulatorTest.class new file mode 100644 index 0000000000000000000000000000000000000000..93074a5d73727ec382c117cf8a9bf74d84c407b5 GIT binary patch literal 1292 zcmX^0Z`VEs1_oP(KrRL*24;2!79Ivx1~x_pfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk- z5<5l)W)00Sb_Nbc2C3AX)Uw2q{33l<C?hyCw=@SN!o|SOzy&gkn~{N4!!t@V3?#zK z!@vhJovE|{#1-IS5M&TyWZ+0oE%8Y$OU(hB?ZW23!T<&!HDWvr;vg;T`FW|qC8=P2 zk~|DjATf^OlKcX{)QS?2LKz+gSq3?XVZkMdC8>-IG8&pba3^}g+^7PUwdQ0{U{GXd zP~u@wW>8^dkieyok%1*R#6N(MK?=87Ap6yL7}P<I;srShDI7EzwAdN6c^GsUbQu{G z@{7{-vr6+aOZ2l!3o=Vmi}Vu<GW8vci&KkAGV}9_85wvI!5r7Z(!`u%aNv1rhOs$t zfJ20Vi$RmY5M-DUNXo?p6t0>KCLj@0Mh0~aAM|*$#uU*E<6tmnWDwE~HqZ?<&<!=z z4K>pBH`Wa{2KmF1hrx=$nvsDsJ+;KOEH$sBn2|w5LleoE;F6-uymV`J23tl3Ie4(a zf*0=fkksN5Mg|t={FGEi27aH+yi~u^+@#c^ki?{%R7M6NpZw&+oUp{AOb{O`$WoG# zS<J|wfCy@=##%En@Rp<&m$)OG$XLwCAcIGnH6sIiUJ@t;6*Dq0dNMNb2A3ozXZt1= zK&_SxD$Og&%uNl;EY3{INp;N2%P&cU#)*s%_ILw%(VCHgD>%QjC^^+F6XY)`tS;6A z#S0??k7r(9YLRmeD2|KS8T=U;gx~=PPoRtptl%WdpvYjuzyywWCI&`OzGPrzuw!6g z&}U#|U}RumVAa~rz_^itfq{v^o`HdZ4J^pc;K0DZzyoHpGB`3gfemnGU}IncYyQN* z!obYHz>v0^fjv@yi)A|lrw_BO_BI9{?QIPFA`HSa<}mPTZ(|T`VPahV|DE<W1_|wL z4APqz<d-6ezt`Tzpeo=dvx7lHgh3Caa|eULCI)$s(j5%OLT1|A7%X-$7=v8L40fFp zg8%~q12+RV0}lf)10RDRg8+jJgCK(fg8+jXgD`^@g9w8OgD8Uqg9w8igE)f|gEWH& zgDgW3gFHhFgCavJgA&+h3J}*rea6iY&EUe|%D~9L%Mi)n#^BDt#NYw;Kg(YRL3Rdq kMiFLV22W_{c!9&p8%+8z_%bjsa4|44C@}aj1UN_n0Mn8tR{#J2 literal 0 HcmV?d00001 diff --git a/build/reports/tests/test/classes/elevator.ElevatorSimulatorTest.html b/build/reports/tests/test/classes/elevator.ElevatorSimulatorTest.html new file mode 100644 index 0000000..221f45b --- /dev/null +++ b/build/reports/tests/test/classes/elevator.ElevatorSimulatorTest.html @@ -0,0 +1,96 @@ +<!DOCTYPE html> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +<meta http-equiv="x-ua-compatible" content="IE=edge"/> +<title>Test results - ElevatorSimulatorTest</title> +<link href="../css/base-style.css" rel="stylesheet" type="text/css"/> +<link href="../css/style.css" rel="stylesheet" type="text/css"/> +<script src="../js/report.js" type="text/javascript"></script> +</head> +<body> +<div id="content"> +<h1>ElevatorSimulatorTest</h1> +<div class="breadcrumbs"> +<a href="../index.html">all</a> > +<a href="../packages/elevator.html">elevator</a> > ElevatorSimulatorTest</div> +<div id="summary"> +<table> +<tr> +<td> +<div class="summaryGroup"> +<table> +<tr> +<td> +<div class="infoBox" id="tests"> +<div class="counter">1</div> +<p>tests</p> +</div> +</td> +<td> +<div class="infoBox" id="failures"> +<div class="counter">0</div> +<p>failures</p> +</div> +</td> +<td> +<div class="infoBox" id="ignored"> +<div class="counter">0</div> +<p>ignored</p> +</div> +</td> +<td> +<div class="infoBox" id="duration"> +<div class="counter">0.040s</div> +<p>duration</p> +</div> +</td> +</tr> +</table> +</div> +</td> +<td> +<div class="infoBox success" id="successRate"> +<div class="percent">100%</div> +<p>successful</p> +</div> +</td> +</tr> +</table> +</div> +<div id="tabs"> +<ul class="tabLinks"> +<li> +<a href="#tab0">Tests</a> +</li> +</ul> +<div id="tab0" class="tab"> +<h2>Tests</h2> +<table> +<thead> +<tr> +<th>Test</th> +<th>Duration</th> +<th>Result</th> +</tr> +</thead> +<tr> +<td class="success">testGetEvents()</td> +<td class="success">0.040s</td> +<td class="success">passed</td> +</tr> +</table> +</div> +</div> +<div id="footer"> +<p> +<div> +<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines +<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/> +</label> +</div>Generated by +<a href="http://www.gradle.org">Gradle 7.5.1</a> at 14 sept. 2022, 15:50:37</p> +</div> +</div> +</body> +</html> diff --git a/build/reports/tests/test/css/base-style.css b/build/reports/tests/test/css/base-style.css new file mode 100644 index 0000000..4afa73e --- /dev/null +++ b/build/reports/tests/test/css/base-style.css @@ -0,0 +1,179 @@ + +body { + margin: 0; + padding: 0; + font-family: sans-serif; + font-size: 12pt; +} + +body, a, a:visited { + color: #303030; +} + +#content { + padding-left: 50px; + padding-right: 50px; + padding-top: 30px; + padding-bottom: 30px; +} + +#content h1 { + font-size: 160%; + margin-bottom: 10px; +} + +#footer { + margin-top: 100px; + font-size: 80%; + white-space: nowrap; +} + +#footer, #footer a { + color: #a0a0a0; +} + +#line-wrapping-toggle { + vertical-align: middle; +} + +#label-for-line-wrapping-toggle { + vertical-align: middle; +} + +ul { + margin-left: 0; +} + +h1, h2, h3 { + white-space: nowrap; +} + +h2 { + font-size: 120%; +} + +ul.tabLinks { + padding-left: 0; + padding-top: 10px; + padding-bottom: 10px; + overflow: auto; + min-width: 800px; + width: auto !important; + width: 800px; +} + +ul.tabLinks li { + float: left; + height: 100%; + list-style: none; + padding-left: 10px; + padding-right: 10px; + padding-top: 5px; + padding-bottom: 5px; + margin-bottom: 0; + -moz-border-radius: 7px; + border-radius: 7px; + margin-right: 25px; + border: solid 1px #d4d4d4; + background-color: #f0f0f0; +} + +ul.tabLinks li:hover { + background-color: #fafafa; +} + +ul.tabLinks li.selected { + background-color: #c5f0f5; + border-color: #c5f0f5; +} + +ul.tabLinks a { + font-size: 120%; + display: block; + outline: none; + text-decoration: none; + margin: 0; + padding: 0; +} + +ul.tabLinks li h2 { + margin: 0; + padding: 0; +} + +div.tab { +} + +div.selected { + display: block; +} + +div.deselected { + display: none; +} + +div.tab table { + min-width: 350px; + width: auto !important; + width: 350px; + border-collapse: collapse; +} + +div.tab th, div.tab table { + border-bottom: solid #d0d0d0 1px; +} + +div.tab th { + text-align: left; + white-space: nowrap; + padding-left: 6em; +} + +div.tab th:first-child { + padding-left: 0; +} + +div.tab td { + white-space: nowrap; + padding-left: 6em; + padding-top: 5px; + padding-bottom: 5px; +} + +div.tab td:first-child { + padding-left: 0; +} + +div.tab td.numeric, div.tab th.numeric { + text-align: right; +} + +span.code { + display: inline-block; + margin-top: 0em; + margin-bottom: 1em; +} + +span.code pre { + font-size: 11pt; + padding-top: 10px; + padding-bottom: 10px; + padding-left: 10px; + padding-right: 10px; + margin: 0; + background-color: #f7f7f7; + border: solid 1px #d0d0d0; + min-width: 700px; + width: auto !important; + width: 700px; +} + +span.wrapped pre { + word-wrap: break-word; + white-space: pre-wrap; + word-break: break-all; +} + +label.hidden { + display: none; +} \ No newline at end of file diff --git a/build/reports/tests/test/css/style.css b/build/reports/tests/test/css/style.css new file mode 100644 index 0000000..3dc4913 --- /dev/null +++ b/build/reports/tests/test/css/style.css @@ -0,0 +1,84 @@ + +#summary { + margin-top: 30px; + margin-bottom: 40px; +} + +#summary table { + border-collapse: collapse; +} + +#summary td { + vertical-align: top; +} + +.breadcrumbs, .breadcrumbs a { + color: #606060; +} + +.infoBox { + width: 110px; + padding-top: 15px; + padding-bottom: 15px; + text-align: center; +} + +.infoBox p { + margin: 0; +} + +.counter, .percent { + font-size: 120%; + font-weight: bold; + margin-bottom: 8px; +} + +#duration { + width: 125px; +} + +#successRate, .summaryGroup { + border: solid 2px #d0d0d0; + -moz-border-radius: 10px; + border-radius: 10px; +} + +#successRate { + width: 140px; + margin-left: 35px; +} + +#successRate .percent { + font-size: 180%; +} + +.success, .success a { + color: #008000; +} + +div.success, #successRate.success { + background-color: #bbd9bb; + border-color: #008000; +} + +.failures, .failures a { + color: #b60808; +} + +.skipped, .skipped a { + color: #c09853; +} + +div.failures, #successRate.failures { + background-color: #ecdada; + border-color: #b60808; +} + +ul.linkList { + padding-left: 0; +} + +ul.linkList li { + list-style: none; + margin-bottom: 5px; +} diff --git a/build/reports/tests/test/index.html b/build/reports/tests/test/index.html new file mode 100644 index 0000000..1a9cc73 --- /dev/null +++ b/build/reports/tests/test/index.html @@ -0,0 +1,133 @@ +<!DOCTYPE html> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +<meta http-equiv="x-ua-compatible" content="IE=edge"/> +<title>Test results - Test Summary</title> +<link href="css/base-style.css" rel="stylesheet" type="text/css"/> +<link href="css/style.css" rel="stylesheet" type="text/css"/> +<script src="js/report.js" type="text/javascript"></script> +</head> +<body> +<div id="content"> +<h1>Test Summary</h1> +<div id="summary"> +<table> +<tr> +<td> +<div class="summaryGroup"> +<table> +<tr> +<td> +<div class="infoBox" id="tests"> +<div class="counter">1</div> +<p>tests</p> +</div> +</td> +<td> +<div class="infoBox" id="failures"> +<div class="counter">0</div> +<p>failures</p> +</div> +</td> +<td> +<div class="infoBox" id="ignored"> +<div class="counter">0</div> +<p>ignored</p> +</div> +</td> +<td> +<div class="infoBox" id="duration"> +<div class="counter">0.040s</div> +<p>duration</p> +</div> +</td> +</tr> +</table> +</div> +</td> +<td> +<div class="infoBox success" id="successRate"> +<div class="percent">100%</div> +<p>successful</p> +</div> +</td> +</tr> +</table> +</div> +<div id="tabs"> +<ul class="tabLinks"> +<li> +<a href="#tab0">Packages</a> +</li> +<li> +<a href="#tab1">Classes</a> +</li> +</ul> +<div id="tab0" class="tab"> +<h2>Packages</h2> +<table> +<thead> +<tr> +<th>Package</th> +<th>Tests</th> +<th>Failures</th> +<th>Ignored</th> +<th>Duration</th> +<th>Success rate</th> +</tr> +</thead> +<tbody> +<tr> +<td class="success"> +<a href="packages/elevator.html">elevator</a> +</td> +<td>1</td> +<td>0</td> +<td>0</td> +<td>0.040s</td> +<td class="success">100%</td> +</tr> +</tbody> +</table> +</div> +<div id="tab1" class="tab"> +<h2>Classes</h2> +<table> +<thead> +<tr> +<th>Class</th> +<th>Tests</th> +<th>Failures</th> +<th>Ignored</th> +<th>Duration</th> +<th>Success rate</th> +</tr> +</thead> +<tbody> +<tr> +<td class="success"> +<a href="classes/elevator.ElevatorSimulatorTest.html">elevator.ElevatorSimulatorTest</a> +</td> +<td>1</td> +<td>0</td> +<td>0</td> +<td>0.040s</td> +<td class="success">100%</td> +</tr> +</tbody> +</table> +</div> +</div> +<div id="footer"> +<p> +<div> +<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines +<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/> +</label> +</div>Generated by +<a href="http://www.gradle.org">Gradle 7.5.1</a> at 14 sept. 2022, 15:50:37</p> +</div> +</div> +</body> +</html> diff --git a/build/reports/tests/test/js/report.js b/build/reports/tests/test/js/report.js new file mode 100644 index 0000000..83bab4a --- /dev/null +++ b/build/reports/tests/test/js/report.js @@ -0,0 +1,194 @@ +(function (window, document) { + "use strict"; + + var tabs = {}; + + function changeElementClass(element, classValue) { + if (element.getAttribute("className")) { + element.setAttribute("className", classValue); + } else { + element.setAttribute("class", classValue); + } + } + + function getClassAttribute(element) { + if (element.getAttribute("className")) { + return element.getAttribute("className"); + } else { + return element.getAttribute("class"); + } + } + + function addClass(element, classValue) { + changeElementClass(element, getClassAttribute(element) + " " + classValue); + } + + function removeClass(element, classValue) { + changeElementClass(element, getClassAttribute(element).replace(classValue, "")); + } + + function initTabs() { + var container = document.getElementById("tabs"); + + tabs.tabs = findTabs(container); + tabs.titles = findTitles(tabs.tabs); + tabs.headers = findHeaders(container); + tabs.select = select; + tabs.deselectAll = deselectAll; + tabs.select(0); + + return true; + } + + function getCheckBox() { + return document.getElementById("line-wrapping-toggle"); + } + + function getLabelForCheckBox() { + return document.getElementById("label-for-line-wrapping-toggle"); + } + + function findCodeBlocks() { + var spans = document.getElementById("tabs").getElementsByTagName("span"); + var codeBlocks = []; + for (var i = 0; i < spans.length; ++i) { + if (spans[i].className.indexOf("code") >= 0) { + codeBlocks.push(spans[i]); + } + } + return codeBlocks; + } + + function forAllCodeBlocks(operation) { + var codeBlocks = findCodeBlocks(); + + for (var i = 0; i < codeBlocks.length; ++i) { + operation(codeBlocks[i], "wrapped"); + } + } + + function toggleLineWrapping() { + var checkBox = getCheckBox(); + + if (checkBox.checked) { + forAllCodeBlocks(addClass); + } else { + forAllCodeBlocks(removeClass); + } + } + + function initControls() { + if (findCodeBlocks().length > 0) { + var checkBox = getCheckBox(); + var label = getLabelForCheckBox(); + + checkBox.onclick = toggleLineWrapping; + checkBox.checked = false; + + removeClass(label, "hidden"); + } + } + + function switchTab() { + var id = this.id.substr(1); + + for (var i = 0; i < tabs.tabs.length; i++) { + if (tabs.tabs[i].id === id) { + tabs.select(i); + break; + } + } + + return false; + } + + function select(i) { + this.deselectAll(); + + changeElementClass(this.tabs[i], "tab selected"); + changeElementClass(this.headers[i], "selected"); + + while (this.headers[i].firstChild) { + this.headers[i].removeChild(this.headers[i].firstChild); + } + + var h2 = document.createElement("H2"); + + h2.appendChild(document.createTextNode(this.titles[i])); + this.headers[i].appendChild(h2); + } + + function deselectAll() { + for (var i = 0; i < this.tabs.length; i++) { + changeElementClass(this.tabs[i], "tab deselected"); + changeElementClass(this.headers[i], "deselected"); + + while (this.headers[i].firstChild) { + this.headers[i].removeChild(this.headers[i].firstChild); + } + + var a = document.createElement("A"); + + a.setAttribute("id", "ltab" + i); + a.setAttribute("href", "#tab" + i); + a.onclick = switchTab; + a.appendChild(document.createTextNode(this.titles[i])); + + this.headers[i].appendChild(a); + } + } + + function findTabs(container) { + return findChildElements(container, "DIV", "tab"); + } + + function findHeaders(container) { + var owner = findChildElements(container, "UL", "tabLinks"); + return findChildElements(owner[0], "LI", null); + } + + function findTitles(tabs) { + var titles = []; + + for (var i = 0; i < tabs.length; i++) { + var tab = tabs[i]; + var header = findChildElements(tab, "H2", null)[0]; + + header.parentNode.removeChild(header); + + if (header.innerText) { + titles.push(header.innerText); + } else { + titles.push(header.textContent); + } + } + + return titles; + } + + function findChildElements(container, name, targetClass) { + var elements = []; + var children = container.childNodes; + + for (var i = 0; i < children.length; i++) { + var child = children.item(i); + + if (child.nodeType === 1 && child.nodeName === name) { + if (targetClass && child.className.indexOf(targetClass) < 0) { + continue; + } + + elements.push(child); + } + } + + return elements; + } + + // Entry point. + + window.onload = function() { + initTabs(); + initControls(); + }; +} (window, window.document)); \ No newline at end of file diff --git a/build/reports/tests/test/packages/elevator.html b/build/reports/tests/test/packages/elevator.html new file mode 100644 index 0000000..da20f91 --- /dev/null +++ b/build/reports/tests/test/packages/elevator.html @@ -0,0 +1,103 @@ +<!DOCTYPE html> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +<meta http-equiv="x-ua-compatible" content="IE=edge"/> +<title>Test results - Package elevator</title> +<link href="../css/base-style.css" rel="stylesheet" type="text/css"/> +<link href="../css/style.css" rel="stylesheet" type="text/css"/> +<script src="../js/report.js" type="text/javascript"></script> +</head> +<body> +<div id="content"> +<h1>Package elevator</h1> +<div class="breadcrumbs"> +<a href="../index.html">all</a> > elevator</div> +<div id="summary"> +<table> +<tr> +<td> +<div class="summaryGroup"> +<table> +<tr> +<td> +<div class="infoBox" id="tests"> +<div class="counter">1</div> +<p>tests</p> +</div> +</td> +<td> +<div class="infoBox" id="failures"> +<div class="counter">0</div> +<p>failures</p> +</div> +</td> +<td> +<div class="infoBox" id="ignored"> +<div class="counter">0</div> +<p>ignored</p> +</div> +</td> +<td> +<div class="infoBox" id="duration"> +<div class="counter">0.040s</div> +<p>duration</p> +</div> +</td> +</tr> +</table> +</div> +</td> +<td> +<div class="infoBox success" id="successRate"> +<div class="percent">100%</div> +<p>successful</p> +</div> +</td> +</tr> +</table> +</div> +<div id="tabs"> +<ul class="tabLinks"> +<li> +<a href="#tab0">Classes</a> +</li> +</ul> +<div id="tab0" class="tab"> +<h2>Classes</h2> +<table> +<thread> +<tr> +<th>Class</th> +<th>Tests</th> +<th>Failures</th> +<th>Ignored</th> +<th>Duration</th> +<th>Success rate</th> +</tr> +</thread> +<tr> +<td class="success"> +<a href="../classes/elevator.ElevatorSimulatorTest.html">ElevatorSimulatorTest</a> +</td> +<td>1</td> +<td>0</td> +<td>0</td> +<td>0.040s</td> +<td class="success">100%</td> +</tr> +</table> +</div> +</div> +<div id="footer"> +<p> +<div> +<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines +<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/> +</label> +</div>Generated by +<a href="http://www.gradle.org">Gradle 7.5.1</a> at 14 sept. 2022, 15:50:37</p> +</div> +</div> +</body> +</html> diff --git a/build/test-results/test/TEST-elevator.ElevatorSimulatorTest.xml b/build/test-results/test/TEST-elevator.ElevatorSimulatorTest.xml new file mode 100644 index 0000000..e5c45c5 --- /dev/null +++ b/build/test-results/test/TEST-elevator.ElevatorSimulatorTest.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite name="elevator.ElevatorSimulatorTest" tests="1" skipped="0" failures="0" errors="0" timestamp="2022-09-14T13:50:37" hostname="yokohome.hd.free.fr" time="0.04"> + <properties/> + <testcase name="testGetEvents()" classname="elevator.ElevatorSimulatorTest" time="0.04"/> + <system-out><![CDATA[]]></system-out> + <system-err><![CDATA[]]></system-err> +</testsuite> diff --git a/build/test-results/test/binary/output.bin b/build/test-results/test/binary/output.bin new file mode 100644 index 0000000..e69de29 diff --git a/build/test-results/test/binary/output.bin.idx b/build/test-results/test/binary/output.bin.idx new file mode 100644 index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d GIT binary patch literal 1 IcmZPo000310RR91 literal 0 HcmV?d00001 diff --git a/build/test-results/test/binary/results.bin b/build/test-results/test/binary/results.bin new file mode 100644 index 0000000000000000000000000000000000000000..1e569e79216a36edb971defd67eb1ef097ab62ad GIT binary patch literal 109 zcmZQ(WSXCvlUkNol3%3f3S|Um=9cDwL_$)FOQvBJWnf@zws8?S#K<_IB(=E2J+;KO TEH$sBSVI$?&!7QS`-%Yor2{5< literal 0 HcmV?d00001 diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin new file mode 100644 index 0000000000000000000000000000000000000000..34a1306d3f5e9981b0da5bfedca9316761c5d492 GIT binary patch literal 278 zcmZQ%aAkC43Srh`VdzZFNi9n($uDAMXk=q(Ni8m6XXq>~$<IwJ$xP;8=zz)!xc{6x zzv;WEuj2IPgQgx^q?tK`xm37ac|4g}IaqlaT1yg3QW+T;7#R41`CXYg1Q<Fqb4znT z27^Vp!6ZWi0}_C9SU3fGf~<ZBbj*8TV>I(w+xm}Xd;)3<@;H@aStMATkB3L7|NO}< z@Q!t-{KA(uUp-rzpG#|n+!PGv77&oU^H5^L@hedaW-<#VM&A3)EXc^f$j89R$iT$M v&A`pbz$nPT&;W86qmZ7ktB9j$h?qVLD;qn9I74ezVp$>s0|O%iNS*-z9hpS3 literal 0 HcmV?d00001 diff --git a/build/tmp/compileTestJava/previous-compilation-data.bin b/build/tmp/compileTestJava/previous-compilation-data.bin new file mode 100644 index 0000000000000000000000000000000000000000..bd65e95d1625cc202175d2a4d1113d905bed039c GIT binary patch literal 2422 zcmZQ%2w@Cna%I+IVdzZFNi9n($uDAMXk=sPfO6OwIx}-ib3o!83@xd}B?A4jk0%{@ zy-Ozi8|MUGEyf3|oFQC#+<H8Eyn1{LE%`<1{0wbbrFoep0t_8lr3INKsYQYeEr|u0 ztQ?FCj0_Ay!NMvcuA-jItZb}e46P-JC8>;z3=9n7j$9H9UB$(zMJ1W}d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5iB;eJP{s0>)*G3|$qe$)%92|Mq(H-KVV5+KIIe{dEc!d&LC=B9H!kBI9&x?lzZK zz1@EQmNV+DVAPXa$;i+K&aX-W4oNdTy^1Hv?N9&n{WPaZfro%_9rK0s6EB;eU3;>x zKxvoSDn`B4jCvVs7#Z3#^KvrtQk4Xfg{El>_?CZcRJqfxWHSHJT1LHfjCyM885z1$ zGK&kKHITrib8{bD-^o?bvSZGo6H{iL<(Fh+U}R*FVpx-#pHi9wshJe=(-hS6i_-NF z)t$ORMq;r-az<iadTL56!#ZrLp@oGWsHi|uFT}{e#3;g0&ae@yHbnl>ODxDl(J8{n zz$nSk%*e>V>dHBfaVeuXLpviQgHmWvluV+sN{XhQxm8+TwrydFLsfNMBctPF#_5c+ z7-us&Eobyw#TdAjkzooWBLibIBZC~nYINK4QcLtebsV^!MzNQhVKcg7P<Vh_A$rg@ z2!><lfou|ISPG$B85tNk89W$v;5G<Wh3G*m5ELgcG=SPLj2jsBHZq26VhrBQ=(>eb apM{l;ontE_Lu*!ISt0`i1GoXizyJX4!gv7y literal 0 HcmV?d00001 diff --git a/src/main/java/elevator/TestAutomaticElevator.java b/src/main/java/elevator/TestAutomaticElevator.java deleted file mode 100644 index 5a9c802..0000000 --- a/src/main/java/elevator/TestAutomaticElevator.java +++ /dev/null @@ -1,33 +0,0 @@ -package elevator; - -import static elevator.IElevator.State.STOP; - -public class TestAutomaticElevator { - - public static void main(String[] args) throws Exception { - // 10 étages et mode automatique - var e = new ElevatorSimulator(10, false); - // activer la montée - e.up(); - // surveiller l'évolution de l'ascenseur - for (int lift = 0; (e.getState() != STOP);) { - Thread.sleep(100); - // tester le franchissement d'étage - if (e.getAndResetStageSensor()) { - // au troisième étage, stopper au suivant - if (++lift == 3) { - e.stopNext(); - } - } - } - e.stopSimulator(); - - // vérifions que tout est OK - boolean ok = (4.0 == e.getLevel()); - ok = ok && (STOP == e.getState()); - ok = ok && ("-S0-U0-U1-U2-U3-O4-S4".equals(e.getEvents())); - if (!ok) { - throw new IllegalStateException(); - } - } -} \ No newline at end of file diff --git a/src/test/java/ElevatorSimulatorTest.java b/src/test/java/ElevatorSimulatorTest.java deleted file mode 100644 index 05dc748..0000000 --- a/src/test/java/ElevatorSimulatorTest.java +++ /dev/null @@ -1,2 +0,0 @@ -public class ElevatorSimulatorTest { -} diff --git a/src/test/java/PanelSimulatorTest.java b/src/test/java/elevator/ElevatorSimulatorTest.java similarity index 59% rename from src/test/java/PanelSimulatorTest.java rename to src/test/java/elevator/ElevatorSimulatorTest.java index 9825692..99d056e 100644 --- a/src/test/java/PanelSimulatorTest.java +++ b/src/test/java/elevator/ElevatorSimulatorTest.java @@ -1,9 +1,10 @@ -import elevator.ElevatorSimulator; -import org.junit.jupiter.api.Test; +package elevator; import static elevator.IElevator.State.STOP; -import static org.assertj.core.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; -public class PanelSimulatorTest { +public class ElevatorSimulatorTest { @Test void testGetEvents(){ @@ -23,10 +24,12 @@ public class PanelSimulatorTest { // vérifions que tout est OK // (3 étages * 3 mètres * 5 étapes) + 25 étapes pour les portes - boolean ok = (((3 * 3 * 5) + 25) == nbSteps); - ok = ok && (3.0 == s.getLevel()); - ok = ok && (STOP == s.getState()); - ok = ok && ("-S0-U0-U1-U2-O3-S3".equals(s.getEvents())); - assertThat(ok).isTrue(); + assertEquals(70, nbSteps); + // l'ascenseur doit être au 3ème + assertEquals(3.0, s.getLevel()); + // l'ascenseur doit être à l'arret + assertEquals(STOP, s.getState()); + // les étapes sont + assertEquals("-S0-U0-U1-U2-O3-S3", s.getEvents()); } } diff --git a/src/test/java/elevator/TestAutomaticElevator.java b/src/test/java/elevator/TestAutomaticElevator.java new file mode 100644 index 0000000..905ee4e --- /dev/null +++ b/src/test/java/elevator/TestAutomaticElevator.java @@ -0,0 +1,41 @@ +package elevator; + +import static elevator.IElevator.State.STOP; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +public class TestAutomaticElevator { + + @Test + public void testAutomaticElevator() throws Exception { + // 10 étages et mode automatique + var e = new ElevatorSimulator(10, false); + // initialement, l'ascenseur est au RdC + int lift = 0; + // activer la montée + e.up(); + // surveiller l'évolution de l'ascenseur + for (; (e.getState() != STOP);) { + Thread.sleep(100); + // tester le franchissement d'étage + if (e.getAndResetStageSensor()) { + // au troisième étage, stopper au suivant + if (++lift == 3) { + e.stopNext(); + } + } + } + e.stopSimulator(); + + // l'ascenseur est au 4ème + assertEquals(4.0, e.getLevel()); + // l'ascenseur est au 4ème + assertEquals(4, lift); + // l'ascenseur est à l'arret + assertEquals(STOP, e.getState()); + // les étapes + assertEquals("-S0-U0-U1-U2-U3-O4-S4", e.getEvents()); + } + +} \ No newline at end of file -- GitLab