-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba1bf66
commit 87bd577
Showing
16 changed files
with
252 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ _release | |
*.install | ||
images/diff.png | ||
test/test-images/_*.png | ||
|
||
vcpkg_installed/* | ||
_opam/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,53 @@ | ||
open Odiff.Diff | ||
(* open Odiff.Diff *) | ||
|
||
let printDiffResult makeParsableOutput result = | ||
(match (result, makeParsableOutput) with | ||
| Layout, true -> "" | ||
| Layout, false -> | ||
Pastel.createElement | ||
~children: | ||
[ | ||
(Pastel.createElement ~color:Red ~bold:true ~children:[ "Failure!" ] | ||
() [@JSX]); | ||
" Images have different layout.\n"; | ||
] | ||
() [@JSX] | ||
| Pixel (_output, diffCount, _percentage, _lines), true when diffCount == 0 -> | ||
"" | ||
| Pixel (_output, diffCount, _percentage, _lines), false when diffCount == 0 | ||
-> | ||
Pastel.createElement | ||
~children: | ||
[ | ||
(Pastel.createElement ~color:Green ~bold:true | ||
~children:[ "Success!" ] () [@JSX]); | ||
" Images are equal.\n"; | ||
(Pastel.createElement ~dim:true | ||
~children:[ "No diff output created." ] | ||
() [@JSX]); | ||
] | ||
() [@JSX] | ||
| Pixel (_output, diffCount, diffPercentage, stack), true | ||
when not (Stack.is_empty stack) -> | ||
Int.to_string diffCount ^ ";" | ||
^ Float.to_string diffPercentage | ||
^ ";" | ||
^ (stack | ||
|> Stack.fold (fun acc line -> (line |> Int.to_string) ^ "," ^ acc) "") | ||
| Pixel (_output, diffCount, diffPercentage, _), true -> | ||
Int.to_string diffCount ^ ";" ^ Float.to_string diffPercentage | ||
| Pixel (_output, diffCount, diffPercentage, _lines), false -> | ||
Pastel.createElement | ||
~children: | ||
[ | ||
(Pastel.createElement ~color:Red ~bold:true ~children:[ "Failure!" ] | ||
() [@JSX]); | ||
" Images are different.\n"; | ||
"Different pixels: "; | ||
(Pastel.createElement ~color:Red ~bold:true | ||
~children:[ Printf.sprintf "%i (%f%%)" diffCount diffPercentage ] | ||
() [@JSX]); | ||
] | ||
() [@JSX]) | ||
|> Console.log; | ||
(* (match (result, makeParsableOutput) with *) | ||
(* | Layout, true -> "" *) | ||
(* | Layout, false -> *) | ||
(* Pastel.createElement *) | ||
(* ~children: *) | ||
(* [ *) | ||
(* (Pastel.createElement ~color:Red ~bold:true ~children:[ "Failure!" ] *) | ||
(* () [@JSX]); *) | ||
(* " Images have different layout.\n"; *) | ||
(* ] *) | ||
(* () [@JSX] *) | ||
(* | Pixel (_output, diffCount, _percentage, _lines), true when diffCount == 0 -> *) | ||
(* "" *) | ||
(* | Pixel (_output, diffCount, _percentage, _lines), false when diffCount == 0 *) | ||
(* -> *) | ||
(* Pastel.createElement *) | ||
(* ~children: *) | ||
(* [ *) | ||
(* (Pastel.createElement ~color:Green ~bold:true *) | ||
(* ~children:[ "Success!" ] () [@JSX]); *) | ||
(* " Images are equal.\n"; *) | ||
(* (Pastel.createElement ~dim:true *) | ||
(* ~children:[ "No diff output created." ] *) | ||
(* () [@JSX]); *) | ||
(* ] *) | ||
(* () [@JSX] *) | ||
(* | Pixel (_output, diffCount, diffPercentage, stack), true *) | ||
(* when not (Stack.is_empty stack) -> *) | ||
(* Int.to_string diffCount ^ ";" *) | ||
(* ^ Float.to_string diffPercentage *) | ||
(* ^ ";" *) | ||
(* ^ (stack *) | ||
(* |> Stack.fold (fun acc line -> (line |> Int.to_string) ^ "," ^ acc) "") *) | ||
(* | Pixel (_output, diffCount, diffPercentage, _), true -> *) | ||
(* Int.to_string diffCount ^ ";" ^ Float.to_string diffPercentage *) | ||
(* | Pixel (_output, diffCount, diffPercentage, _lines), false -> *) | ||
(* Pastel.createElement *) | ||
(* ~children: *) | ||
(* [ *) | ||
(* (Pastel.createElement ~color:Red ~bold:true ~children:[ "Failure!" ] *) | ||
(* () [@JSX]); *) | ||
(* " Images are different.\n"; *) | ||
(* "Different pixels: "; *) | ||
(* (Pastel.createElement ~color:Red ~bold:true *) | ||
(* ~children:[ Printf.sprintf "%i (%f%%)" diffCount diffPercentage ] *) | ||
(* () [@JSX]); *) | ||
(* ] *) | ||
(* () [@JSX]) *) | ||
(* |> Console.log; *) | ||
result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.