Skip to content

Commit

Permalink
! F numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
isidore committed Sep 14, 2023
1 parent f7a81d7 commit 96574f4
Show file tree
Hide file tree
Showing 5 changed files with 2,384 additions and 3 deletions.
59 changes: 59 additions & 0 deletions src/main/java/org/samples/_1_Numbers.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package org.samples;

public class _1_Numbers {
public int calculate(int n, int j, double name) {

if (n == 32) {
name = name * 3.5;
double temp = 0.0;
for (int i = 0; i < j; i++) {
temp = (name + n) / 5;
if (10 < temp || temp < 17) {
if (temp < 14) {
return 43;
}
if (temp > 15) {
return 56;
}
}
}
if (temp < 50) {
return 12;
}
}
if (n % 13 == 1) {
if (j == 5) {
return 402;
}
} else if (n % 18 == 0) {
if (j == 4) {
return n;
}
} else if (name < 5) {
if (j == 2) {
return n;
} else {
return 42;
}
} else {
if (n % 5 == 1) {
if (j > 3) {
return 132;
}
} else if (n % 23 == 3) {
if (j == n) {
return j;
}
} else if (name > 17) {
if (j == n) {
return n;
} else {
return j - n;
}
}
}


return -1;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.security.InvalidParameterException;


public class Request extends RequestBase {
public class _2_Request extends RequestBase {

public void doParseParameters() {
if (parametersParsed) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/samples/required/RequestBase.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.samples.required;

import jakarta.servlet.http.Part;
import org.samples.Request;
import org.samples._2_Request;

import java.io.IOException;
import java.nio.charset.Charset;
Expand All @@ -13,7 +13,7 @@ public class RequestBase {
*/
protected static final int CACHED_POST_LEN = 8192;
protected Parameters response;
protected Request coyoteRequest;
protected _2_Request coyoteRequest;
protected Parameters sm;
/**
* Using stream flag.
Expand Down
10 changes: 10 additions & 0 deletions src/test/java/org/samples/SampleTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@


import org.approvaltests.Approvals;
import org.approvaltests.combinations.CombinationApprovals;
import org.junit.jupiter.api.Test;
import org.lambda.utils.Range;

import static org.junit.jupiter.api.Assertions.assertEquals;

Expand All @@ -14,4 +16,12 @@ public void testNormalJunit()
assertEquals(5, 5);
}

@Test
void testNumbers() {
_1_Numbers numbers = new _1_Numbers();
Integer[] ns = Range.get(0,33);
Integer[] js = ns;
Double[] names = {3.0,18.0};
CombinationApprovals.verifyAllCombinations(numbers::calculate,ns, js, names);
}
}
Loading

0 comments on commit 96574f4

Please sign in to comment.