Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider 9b69ed9f rédigé par SIM's avatar SIM Validation de GitHub
Parcourir les fichiers

Merge pull request #1 from SIMIIIIIII/FIRST

Premier commit juste pour tester avec la fonction factorielle
parents 1ef2858a d8951f6d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId> <groupId>com.example</groupId>
<artifactId>SIM-Algo</artifactId> <artifactId>mon-projet</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<properties> <properties>
<maven.compiler.source>23</maven.compiler.source> <maven.compiler.source>17</maven.compiler.source> <!-- Java source version -->
<maven.compiler.target>23</maven.compiler.target> <maven.compiler.target>17</maven.compiler.target> <!-- Java target version -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <junit.version>5.9.2</junit.version> <!-- Dernière version stable de JUnit -->
<javagrader.version>1.0.6</javagrader.version> <!-- Version actuelle de JavaGrader -->
</properties> </properties>
<dependencies>
<!-- JUnit Jupiter API pour les tests -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- JUnit Jupiter Engine pour exécuter les tests -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- JavaGrader pour l'évaluation automatisée des réponses -->
<dependency>
<groupId>io.github.ucl-ingi</groupId>
<artifactId>JavaGrader</artifactId>
<version>${javagrader.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Maven Compiler Plugin pour choisir la version de Java -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!-- Maven Surefire Plugin pour exécuter les tests JUnit -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M8</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>
\ No newline at end of file
package org.example;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("Hello, World!"); System.out.println("Hello, World!");
......
package algorithms;
public class Factorial {
public static int calculate(int n){
return factorial(n, 1);
}
private static int factorial(int n, int result ){
if(n == 0){
return result;
}
return factorial(n-1, result * n);
}
}
import algorithms.Factorial;
import org.javagrader.Grade;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
@Grade
public class FactorialTest {
@Test
@Grade(value = 1)
public void testFactorial(){
assertEquals(6, Factorial.calculate(3));
}
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter