commit bd3f50498c4a708db49f764fb9560a08269fcbab Author: Alexis Drai Date: Fri Jan 20 16:54:56 2023 +0100 :tada: diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..257ce1d --- /dev/null +++ b/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3013e6b --- /dev/null +++ b/.gitignore @@ -0,0 +1,87 @@ +# ---> Java +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* + +# ---> Eclipse +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ +.apt_generated_test/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +# Uncomment this line if you wish to ignore the project description file. +# Typically, this file would be tracked if it contains build/dependency configurations: +#.project diff --git a/.project b/.project new file mode 100644 index 0000000..e4e3699 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + QA2 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/src/fr/iut/uca/Operations.java b/src/fr/iut/uca/Operations.java new file mode 100644 index 0000000..f12cd15 --- /dev/null +++ b/src/fr/iut/uca/Operations.java @@ -0,0 +1,37 @@ +package fr.iut.uca; + +public class Operations { + public long Add(long a, long b, long... others) { + + long res = a + b; + for(long num : others) { + res += num; + } + return res; + } + + public long Multiply(long a, long b, long... others) { + + long res = a * b; + for(long num : others) { + + res *= num; + } + return res; + } + + public long Divide(long a, long b, long... others) { + if(b == 0) { + throw new ArithmeticException("attempted to divide by zero"); + } + long res = a / b; + for(long num : others) { + if(num == 0) { + throw new ArithmeticException("attempted to divide by zero"); + } + res *= num; + } + return res; + } + +} diff --git a/src/fr/iut/uca/OperationsTest.java b/src/fr/iut/uca/OperationsTest.java new file mode 100644 index 0000000..a971610 --- /dev/null +++ b/src/fr/iut/uca/OperationsTest.java @@ -0,0 +1,27 @@ +package fr.iut.uca; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +class OperationsTest { + + @Test + void nominalTest() { + // Arrange + + Operations operations = new Operations(); + int x = 1; + int y = 2; + int expected = 3; + + // Act + + + + // Assert + + + } + +} diff --git a/src/fr/iut/uca/PleaseEclipseCmon.java b/src/fr/iut/uca/PleaseEclipseCmon.java new file mode 100644 index 0000000..f0c315b --- /dev/null +++ b/src/fr/iut/uca/PleaseEclipseCmon.java @@ -0,0 +1,11 @@ +package fr.iut.uca; + +public class PleaseEclipseCmon { + + public static void main(String[] args) { + + Operations operation = new Operations(); + System.out.println(operation.Add(2, 2, 2, 2, 3)); + System.out.println(0 == -0); + } +}