Skip to content

Commit

Permalink
feat(objectionary#329): change the code in 'streams' integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Jul 9, 2024
1 parent 491fece commit 5b4e635
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/it/streams/src/main/java/org/eolang/streams/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
package org.eolang.streams;

import java.util.Arrays;
import java.util.stream.IntStream;

public class Main {
public static void main(String... args) {
long start = System.currentTimeMillis();
String[] strings = new String[10];
for (int i = 0; i < strings.length; i++) {
strings[i] = String.valueOf(i);
}
String[] strings = IntStream.range(0, 10)
.mapToObj(i -> String.valueOf(i))
.toArray(String[]::new);
int sum = Arrays.stream(strings)
.filter(s -> !s.equals(""))
.filter(s -> Boolean.valueOf(s.equals("")).equals(false))
.mapToInt(s -> Integer.parseInt(s))
.sum();
System.out.printf("sum=%d time=%d\n", sum, System.currentTimeMillis() - start);
Expand Down
9 changes: 9 additions & 0 deletions src/it/streams/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,13 @@ String log = new File(basedir, 'build.log').text;
assert log.contains("BUILD SUCCESS")
assert log.contains("sum=")
assert log.contains("time=")
// Check all files.
// Decompilation output.
assert new File(basedir, 'target/generated-sources/opeo-decompile-xmir/org/eolang/streams/Main.xmir').exists()
// Compilation output.
assert new File(basedir, 'target/generated-sources/opeo-compile-xmir/org/eolang/streams/Main.xmir').exists()
// Phi expressions output.
assert new File(basedir, 'target/generated-sources/phi-expressions/org/eolang/streams/Main.phi').exists()
// Check that we honestly decompiled and compiled the same file.
assert new File(basedir, 'target/generated-sources/opeo-decompile-modified-xmir/org/eolang/streams/Main.xmir').exists()
true

0 comments on commit 5b4e635

Please sign in to comment.