Skip to content
Snippets Groups Projects
Commit e448546f authored by LABOUREL Arnaud's avatar LABOUREL Arnaud
Browse files

Version bio-info 2022

parent efc164be
No related branches found
No related tags found
No related merge requests found
...@@ -22,12 +22,14 @@ ...@@ -22,12 +22,14 @@
.idea/**/dynamic.xml .idea/**/dynamic.xml
.idea/**/uiDesigner.xml .idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml .idea/**/dbnavigator.xml
.gradle/
.idea/
# Gradle # Gradle
.idea/gradle.xml .idea/**/gradle.xml
.idea/workspaces.xml
.idea/**/libraries .idea/**/libraries
.idea/misc.xml
.idea/vcs.xml
# Gradle and Maven with auto-import # Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files, # When using Gradle or Maven with auto-import, you should exclude module files,
...@@ -37,7 +39,7 @@ ...@@ -37,7 +39,7 @@
.idea/compiler.xml .idea/compiler.xml
.idea/jarRepositories.xml .idea/jarRepositories.xml
.idea/modules.xml .idea/modules.xml
.idea/*.iml idea/*.iml
.idea/modules .idea/modules
*.iml *.iml
*.ipr *.ipr
......
image: gradle:jdk17 image: openjdk:17-alpine
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
before_script: before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle - export GRADLE_USER_HOME=`pwd`/.gradle
...@@ -8,11 +11,30 @@ cache: ...@@ -8,11 +11,30 @@ cache:
- .gradle/wrapper - .gradle/wrapper
- .gradle/caches - .gradle/caches
stages:
- build
- test
build:
stage: build
script: ./gradlew --build-cache assemble
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
java: java:
stage: test stage: test
script: script: ./gradlew test
- gradle test
artifacts: artifacts:
when: always when: always
reports: reports:
junit: build/test-results/test/**/TEST-*.xml junit: build/test-results/test/**/TEST-*.xml
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull
paths:
- build
- .gradle
\ No newline at end of file
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
Le but de ce TP est de créer des classes permettant de représenter des étudiants (classe `Student`), des notes (classe `Grade`), des résultats à une unité d'enseignement (classe `TeachingUnitResult`) et des promotions d'étudiants (classe `Cohort`). Le but de ce TP est de créer des classes permettant de représenter des étudiants (classe `Student`), des notes (classe `Grade`), des résultats à une unité d'enseignement (classe `TeachingUnitResult`) et des promotions d'étudiants (classe `Cohort`).
## Membres du projet ## Membre du projet
- NOM, prénom, numéro de groupe - NOM, prénom, numéro de groupe
plugins { plugins {
id "application" id "application"
id "java"
} }
apply plugin : "java"
group 'l2info' group 'M2_DLAD'
version '1.0-SNAPSHOT' version '1.0-SNAPSHOT'
repositories { repositories {
...@@ -11,18 +11,15 @@ repositories { ...@@ -11,18 +11,15 @@ repositories {
} }
dependencies { dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2', "org.assertj:assertj-core:3.22.0" testImplementation('org.junit.jupiter:junit-jupiter-api:5.9.0',
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' 'org.assertj:assertj-core:3.23.1')
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.9.0')
} }
test { test {
useJUnitPlatform() useJUnitPlatform()
} }
ext {
javaMainClass = "Main"
}
application { application {
mainClassName = javaMainClass mainClassName = "Main"
} }
\ No newline at end of file
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
...@@ -80,13 +80,13 @@ do ...@@ -80,13 +80,13 @@ do
esac esac
done done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # This is normally unused
# shellcheck disable=SC2034
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
...@@ -143,12 +143,16 @@ fi ...@@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
case $MAX_FD in #( case $MAX_FD in #(
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
...@@ -205,6 +209,12 @@ set -- \ ...@@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \ org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args. # Use "xargs" to parse quoted args.
# #
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
......
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.List; import java.util.List;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
class TestCohort { class CohortTest {
private static final Cohort cohort = new Cohort("L2 informatique"); private static final Cohort cohort = new Cohort("L2 informatique");
private static final Student davidGoodenough = new Student("David", "Goodenough"); private static final Student davidGoodenough = new Student("David", "Goodenough");
private static final Student jeanMichelBruitage = new Student("Jean-Michel", "Bruitage"); private static final Student jeanMichelBruitage = new Student("Jean-Michel", "Bruitage");
...@@ -13,23 +14,27 @@ class TestCohort { ...@@ -13,23 +14,27 @@ class TestCohort {
@BeforeAll @BeforeAll
static void addStudentsToCohort(){ static void addStudentsToCohort(){
jeanMichelBruitage.addResult("Programmation 2", TestGrade.zero); jeanMichelBruitage.addResult("Programmation 2", GradeTest.zero);
jeanMichelBruitage.addResult("Structures discrètes", TestGrade.twenty); jeanMichelBruitage.addResult("Structures discrètes", GradeTest.twenty);
davidGoodenough.addResult("Programmation 2", TestGrade.ten); davidGoodenough.addResult("Programmation 2", GradeTest.ten);
davidGoodenough.addResult("Structures discrètes", TestGrade.ten); davidGoodenough.addResult("Structures discrètes", GradeTest.ten);
cohort.addStudent(davidGoodenough); cohort.addStudent(davidGoodenough);
cohort.addStudent(jeanMichelBruitage); cohort.addStudent(jeanMichelBruitage);
} }
@Disabled("Disabled until Cohort is coded")
@Test @Test
void testGetStudentsIsEmpty_whenEmptyCohort(){ void testGetStudentsIsEmpty_whenEmptyCohort(){
assertThat(l1Descartes.getStudents()).isEmpty(); assertThat(l1Descartes.getStudents()).isEmpty();
} }
@Disabled("Disabled until Cohort is coded")
@Test @Test
void testGetStudents_whenCohortContainsStudents(){ void testGetStudents_whenCohortContainsStudents(){
assertThat(cohort.getStudents()).isEqualTo(List.of(davidGoodenough, jeanMichelBruitage)); assertThat(cohort.getStudents()).isEqualTo(List.of(davidGoodenough, jeanMichelBruitage));
} }
@Disabled("Disabled until Cohort is coded")
@Test @Test
void testPrintStudentsResults_whenCohortIsEmpty() { void testPrintStudentsResults_whenCohortIsEmpty() {
StandardOutputSandbox standardOutputSandbox = new StandardOutputSandbox(l1Descartes::printStudentsResults); StandardOutputSandbox standardOutputSandbox = new StandardOutputSandbox(l1Descartes::printStudentsResults);
...@@ -38,6 +43,7 @@ class TestCohort { ...@@ -38,6 +43,7 @@ class TestCohort {
assertThat(standardOutputSandbox.getProducedOutput()).isEqualTo(expectedOutput); assertThat(standardOutputSandbox.getProducedOutput()).isEqualTo(expectedOutput);
} }
@Disabled("Disabled until Cohort is coded")
@Test @Test
void testPrintStudentsResults_whenCohortContainsStudents() { void testPrintStudentsResults_whenCohortContainsStudents() {
StandardOutputSandbox standardOutputSandbox = new StandardOutputSandbox(cohort::printStudentsResults); StandardOutputSandbox standardOutputSandbox = new StandardOutputSandbox(cohort::printStudentsResults);
......
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.List; import java.util.List;
...@@ -5,7 +6,7 @@ import java.util.List; ...@@ -5,7 +6,7 @@ import java.util.List;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.within; import static org.assertj.core.api.Assertions.within;
class TestGrade { class GradeTest {
static Grade twenty = new Grade(20); static Grade twenty = new Grade(20);
static Grade zero = new Grade(0); static Grade zero = new Grade(0);
static Grade ten = new Grade(10); static Grade ten = new Grade(10);
...@@ -13,6 +14,7 @@ class TestGrade { ...@@ -13,6 +14,7 @@ class TestGrade {
private static final List<Grade> grades = List.of(zero, twenty, ten); private static final List<Grade> grades = List.of(zero, twenty, ten);
private static final List<Grade> gradesZero = List.of(zero, zero); private static final List<Grade> gradesZero = List.of(zero, zero);
@Disabled("Disabled until Grade is coded")
@Test @Test
void testHashCode(){ void testHashCode(){
assertThat(twenty.hashCode()).isEqualTo(new Grade(20).hashCode()) assertThat(twenty.hashCode()).isEqualTo(new Grade(20).hashCode())
...@@ -20,6 +22,7 @@ class TestGrade { ...@@ -20,6 +22,7 @@ class TestGrade {
.isNotEqualTo(zero.hashCode()); .isNotEqualTo(zero.hashCode());
} }
@Disabled("Disabled until Grade is coded")
@Test @Test
void testEquals(){ void testEquals(){
assertThat(twenty).isEqualTo(new Grade(20)) assertThat(twenty).isEqualTo(new Grade(20))
...@@ -30,12 +33,14 @@ class TestGrade { ...@@ -30,12 +33,14 @@ class TestGrade {
.isNotEqualTo(20.0); .isNotEqualTo(20.0);
} }
@Disabled("Disabled until Grade is coded")
@Test @Test
void testGetValue() { void testGetValue() {
assertThat(twenty.getValue()).isCloseTo(20, within(EPSILON)); assertThat(twenty.getValue()).isCloseTo(20, within(EPSILON));
assertThat(zero.getValue()).isCloseTo(0, within(EPSILON)); assertThat(zero.getValue()).isCloseTo(0, within(EPSILON));
} }
@Disabled("Disabled until Grade is coded")
@Test @Test
void testToString() { void testToString() {
assertThat(twenty.toString()).isEqualTo("20.0/20"); assertThat(twenty.toString()).isEqualTo("20.0/20");
...@@ -43,6 +48,7 @@ class TestGrade { ...@@ -43,6 +48,7 @@ class TestGrade {
} }
@Disabled("Disabled until Grade is coded")
@Test @Test
void testAverageGrade(){ void testAverageGrade(){
assertThat(Grade.averageGrade(grades)).isEqualTo(ten); assertThat(Grade.averageGrade(grades)).isEqualTo(ten);
......
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.List; import java.util.List;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
class TestStudent { class StudentTest {
private static final Student arnaudLabourel = new Student("Arnaud", "Labourel"); private static final Student arnaudLabourel = new Student("Arnaud", "Labourel");
private static final Student jeanMichelBruitage = new Student("Jean-Michel", "Bruitage"); private static final Student jeanMichelBruitage = new Student("Jean-Michel", "Bruitage");
private static final Student davidGoodenough = new Student("David", "Goodenough"); private static final Student davidGoodenough = new Student("David", "Goodenough");
@Disabled("Disabled until Student is coded")
@BeforeAll @BeforeAll
static void addResultsToStudents(){ static void addResultsToStudents(){
arnaudLabourel.addResult("Programmation 2", TestGrade.twenty); arnaudLabourel.addResult("Programmation 2", GradeTest.twenty);
arnaudLabourel.addResult("Structures discrètes", TestGrade.twenty); arnaudLabourel.addResult("Structures discrètes", GradeTest.twenty);
davidGoodenough.addResult("Programmation 2", TestGrade.ten); davidGoodenough.addResult("Programmation 2", GradeTest.ten);
davidGoodenough.addResult("Structures discrètes", TestGrade.zero); davidGoodenough.addResult("Structures discrètes", GradeTest.zero);
jeanMichelBruitage.addResult("Programmation 2", TestGrade.ten); jeanMichelBruitage.addResult("Programmation 2", GradeTest.ten);
jeanMichelBruitage.addResult("Structures discrètes", TestGrade.twenty); jeanMichelBruitage.addResult("Structures discrètes", GradeTest.twenty);
} }
@Disabled("Disabled until Student is coded")
@Test @Test
void testHashCode(){ void testHashCode(){
assertThat(jeanMichelBruitage.hashCode()).isEqualTo(new Student("Jean-Michel", "Bruitage").hashCode()) assertThat(jeanMichelBruitage.hashCode()).isEqualTo(new Student("Jean-Michel", "Bruitage").hashCode())
.isNotEqualTo(davidGoodenough.hashCode()); .isNotEqualTo(davidGoodenough.hashCode());
} }
@Disabled("Disabled until Student is coded")
@Test @Test
void testEquals(){ void testEquals(){
assertThat(jeanMichelBruitage).isEqualTo(new Student("Jean-Michel", "Bruitage")) assertThat(jeanMichelBruitage).isEqualTo(new Student("Jean-Michel", "Bruitage"))
...@@ -34,26 +38,30 @@ class TestStudent { ...@@ -34,26 +38,30 @@ class TestStudent {
.isNotEqualTo("Jean-Michel Bruitage"); .isNotEqualTo("Jean-Michel Bruitage");
} }
@Disabled("Disabled until Student is coded")
@Test @Test
void testToString() { void testToString() {
assertThat(jeanMichelBruitage.toString()).isEqualTo("Jean-Michel Bruitage"); assertThat(jeanMichelBruitage.toString()).isEqualTo("Jean-Michel Bruitage");
assertThat(davidGoodenough.toString()).isEqualTo("David Goodenough"); assertThat(davidGoodenough.toString()).isEqualTo("David Goodenough");
} }
@Disabled("Disabled until Student is coded")
@Test @Test
void testGetGrades() { void testGetGrades() {
assertThat(arnaudLabourel.getGrades()).isEqualTo(List.of(TestGrade.twenty, TestGrade.twenty)); assertThat(arnaudLabourel.getGrades()).isEqualTo(List.of(GradeTest.twenty, GradeTest.twenty));
assertThat(davidGoodenough.getGrades()).isEqualTo(List.of(TestGrade.ten, TestGrade.zero)); assertThat(davidGoodenough.getGrades()).isEqualTo(List.of(GradeTest.ten, GradeTest.zero));
assertThat(jeanMichelBruitage.getGrades()).isEqualTo(List.of(TestGrade.ten, TestGrade.twenty)); assertThat(jeanMichelBruitage.getGrades()).isEqualTo(List.of(GradeTest.ten, GradeTest.twenty));
} }
@Disabled("Disabled until Student is coded")
@Test @Test
void testGetAverageGrade() { void testGetAverageGrade() {
assertThat(arnaudLabourel.averageGrade()).isEqualTo(TestGrade.twenty); assertThat(arnaudLabourel.averageGrade()).isEqualTo(GradeTest.twenty);
assertThat(davidGoodenough.averageGrade()).isEqualTo(new Grade(5)); assertThat(davidGoodenough.averageGrade()).isEqualTo(new Grade(5));
assertThat(jeanMichelBruitage.averageGrade()).isEqualTo(new Grade(15)); assertThat(jeanMichelBruitage.averageGrade()).isEqualTo(new Grade(15));
} }
@Disabled("Disabled until Student is coded")
@Test @Test
void testPrintResults() { void testPrintResults() {
StandardOutputSandbox standardOutputSandbox = new StandardOutputSandbox(arnaudLabourel::printResults); StandardOutputSandbox standardOutputSandbox = new StandardOutputSandbox(arnaudLabourel::printResults);
......
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
class TestTeachingUnitResult { class TeachingUnitResultTest {
private static final TeachingUnitResult twentyAtProg = private static final TeachingUnitResult twentyAtProg =
new TeachingUnitResult("Programmation 2", TestGrade.twenty); new TeachingUnitResult("Programmation 2", GradeTest.twenty);
private static final TeachingUnitResult zeroAtStructDiscrete = private static final TeachingUnitResult zeroAtStructDiscrete =
new TeachingUnitResult("Structures discrètes", TestGrade.zero); new TeachingUnitResult("Structures discrètes", GradeTest.zero);
@Disabled("Disabled until TeachingUnitResult is coded")
@Test @Test
void testGetGrade() { void testGetGrade() {
assertThat(twentyAtProg.getGrade()).isEqualTo(TestGrade.twenty); assertThat(twentyAtProg.getGrade()).isEqualTo(GradeTest.twenty);
assertThat(zeroAtStructDiscrete.getGrade()).isEqualTo(TestGrade.zero); assertThat(zeroAtStructDiscrete.getGrade()).isEqualTo(GradeTest.zero);
} }
@Disabled("Disabled until TeachingUnitResult is coded")
@Test @Test
void testToString() { void testToString() {
assertThat(twentyAtProg.toString()).isEqualTo("Programmation 2 : 20.0/20"); assertThat(twentyAtProg.toString()).isEqualTo("Programmation 2 : 20.0/20");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment