aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/tests/TestFunctionSet.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/backend/tests/TestFunctionSet.java')
-rw-r--r--src/jcgp/backend/tests/TestFunctionSet.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/jcgp/backend/tests/TestFunctionSet.java b/src/jcgp/backend/tests/TestFunctionSet.java
new file mode 100644
index 0000000..1910d2a
--- /dev/null
+++ b/src/jcgp/backend/tests/TestFunctionSet.java
@@ -0,0 +1,54 @@
+package jcgp.backend.tests;
+
+import jcgp.backend.function.Function;
+import jcgp.backend.function.FunctionSet;
+
+public class TestFunctionSet extends FunctionSet {
+
+ public TestFunctionSet() {
+
+ functionList = new Function[] {
+ new Function() {
+ @Override
+ public Object run(Object... args) {
+ return (Integer) args[0] + (Integer) args[1];
+ }
+ @Override
+ public int getArity() {
+ return 2;
+ }
+ },
+ new Function() {
+ @Override
+ public Object run(Object... args) {
+ return (Integer) args[0] - (Integer) args[1];
+ }
+ @Override
+ public int getArity() {
+ return 2;
+ }
+ },
+ new Function() {
+ @Override
+ public Object run(Object... args) {
+ return (Integer) args[0] * (Integer) args[1];
+ }
+ @Override
+ public int getArity() {
+ return 2;
+ }
+ },
+ new Function() {
+ @Override
+ public Object run(Object... args) {
+ return (Integer) args[0] / (Integer) args[1];
+ }
+ @Override
+ public int getArity() {
+ return 2;
+ }
+ }
+ };
+ enableAll();
+ }
+} \ No newline at end of file