Skip to content

Commit

Permalink
New file exercise for Java
Browse files Browse the repository at this point in the history
  • Loading branch information
rtoal committed Aug 11, 2024
1 parent a8c1d32 commit a896358
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 5 additions & 3 deletions java/Exercises.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import java.util.HashMap;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Stream;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.Files;

public class Exercises {
static Map<Integer, Long> change(long amount) {
Expand All @@ -25,8 +28,7 @@ static Map<Integer, Long> change(long amount) {

// Write your say function here

// Write your file stats function here
// Write your line count function here

// (Your Quaternion and Binary Search Tree solutions will be in
// separate files)
// The other exercises will go in separate files
}
10 changes: 3 additions & 7 deletions java/ExercisesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,12 @@ void run() throws IOException {
// .equals(" dog go"));
// check(Exercises.say("πŸ˜„πŸ€—").and("πŸ’€πŸ‘ŠπŸΎ").ok().equals("πŸ˜„πŸ€— πŸ’€πŸ‘ŠπŸΎ"));

// suite("fileStats");
// suite("meaningfulLineCount");
// checkThrows(
// () -> Exercises.fileStats("NoSuchFile.txt"),
// () -> Exercises.meaningfulLineCount("no-such-file.txt"),
// FileNotFoundException.class,
// "No such file");
// var stats = Exercises.fileStats("../test-for-line-count.txt");
// check(stats.size() == 3);
// check(stats.get("lineCount") == 13);
// check(stats.get("blankLineCount") == 7);
// check(stats.get("hashedLineCount") == 2);
// check(Exercises.meaningfulLineCount("../test-for-line-count.txt") == 5);

// suite("Quaternion");
// checkThrows(() -> new Quaternion(Double.NaN, 0, 0, 0), IllegalArgumentException.class, "Coefficients cannot be NaN");
Expand Down

0 comments on commit a896358

Please sign in to comment.