+ Show Solution
+
+
+ ```elixir
+ Outstanding.outstanding([%{state: :active, status: :working}, %{state: :active, status: :working}],
+ [%{id: 1, state: :active, status: :idle}, %{id: 2, state: :suspended, status: :restricted}])
+ ```
+
+ Which should evaluate to
+ ```elixir
+ [nil, %{state: :active, status: :working}]
+ ```
+
+
+
+
+Now resolve the second child by setting its actual ```state: :active``` and ```status: :working```:
+
+
+ Show Solution
+
+
+ ```elixir
+ Outstanding.outstanding([%{state: :active, status: :working}, %{state: :active, status: :working}],
+ [%{id: 1, state: :active, status: :working}, %{id: 2, state: :active, status: :working}])
+ ```
+
+ Which should evaluate to
+ ```elixir
+ nil
+ ```
+
+
+
+
## How to implement Outstanding for your Types And Structs
You can implement outstanding for any Type or Struct using the Outstand defoutstanding macro.
Expected is of whatever type you are implementing the protocol for, and actual must be of Any type.
-### Outstanding Types
+### Outstanding on any Type
The following is the Outstanding implementation for Regex, which expects actual to match the (evaluated) regex.
We won't evaluate this as it is already defined.
@@ -168,7 +238,7 @@ These tests can be executed
ExUnit.run()
```
-### Outstanding Structs
+### Outstanding on Structs
When implementing Outstanding for a struct, you need to think about what fields you wish to run outstanding on,
what your expectation is for each field, and whether you require actual to have the same struct name, or even be a struct at all.
diff --git a/test/list_of_map_test.exs b/test/list_of_map_test.exs
index f539729..81000fb 100644
--- a/test/list_of_map_test.exs
+++ b/test/list_of_map_test.exs
@@ -6,10 +6,13 @@ defmodule Outstanding.ListOfMapTest do
gen_something_outstanding_test("order outstanding", [%{a: "a"}, %{b: "b"}], [%{b: "b"}, %{a: "a"}])
gen_something_outstanding_test("empty outstanding", [], [%{a: "a"}])
gen_something_outstanding_test("extra outstanding", [%{a: "a"}, %{b: "b"}], [%{a: "a"}, %{b: "b"}, %{c: "c"}])
+ gen_something_outstanding_test("missing outstanding", [%{a: "a"}, %{b: "b"}], [%{a: "a"}])
gen_nothing_outstanding_test("realized", [%{a: "a"}, %{b: "b"}], [%{a: "a"}, %{b: "b"}])
gen_nothing_outstanding_test("realised, extra elements in map", [%{a: "a"}, %{b: "b"}], [%{a: "a", c: "c"}, %{b: "b", d: "d"}])
+ gen_nothing_outstanding_test("realized, empty", [], [])
gen_result_outstanding_test("element result", [%{a: "a"}, %{b: "b"}], [%{b: "b"}, %{c: "c"}], [%{a: "a"}, %{b: "b"}])
gen_result_outstanding_test("order result", [%{a: "a"}, %{b: "b"}], [%{b: "b"}, %{a: "a"}], [%{a: "a"}, %{b: "b"}])
gen_result_outstanding_test("empty result", [], [%{a: "a"}], [])
- gen_result_outstanding_test("extra result", [%{a: "a"}, %{b: "b"}], [%{a: "a"}, %{b: "b"}, %{c: "c"}], [%{a: "a"}, %{b: "b"}])
+ gen_result_outstanding_test("extra result", [%{a: "a"}, %{b: "b"}], [%{a: "a"}, %{b: "b"}, %{c: "c"}], [nil, nil])
+ gen_result_outstanding_test("missing result", [%{a: "a"}, %{b: "b"}], [%{a: "a"}], [nil, %{b: "b"}])
end
diff --git a/test/list_test.exs b/test/list_test.exs
index 5d247cf..03b52bb 100644
--- a/test/list_test.exs
+++ b/test/list_test.exs
@@ -2,14 +2,17 @@ defmodule Outstanding.ListTest do
use ExUnit.Case
use Outstand
+
gen_something_outstanding_test("element outstanding", [:a, :b], [:b, :c])
gen_something_outstanding_test("order outstanding", [:a, :b], [:b, :a])
gen_something_outstanding_test("empty outstanding", [], [:a])
gen_something_outstanding_test("extra outstanding", [:a, :b], [:a, :b, :c])
+ gen_something_outstanding_test("list outstanding, nil", [:a, :b], nil)
gen_nothing_outstanding_test("realized", [:a, :b], [:a, :b])
gen_nothing_outstanding_test("empty realized", [], [])
gen_result_outstanding_test("element result", [:a, :b], [:b, :c], [:a, :b])
gen_result_outstanding_test("order result", [:a, :b], [:b, :a], [:a, :b])
gen_result_outstanding_test("empty result", [], [:a], [])
- gen_result_outstanding_test("extra result", [:a, :b], [:a, :b, :c], [:a, :b])
+ gen_result_outstanding_test("extra result", [:a, :b], [:a, :b, :c], [nil, nil])
+ gen_result_outstanding_test("list result, nil", [:a, :b], nil, [:a, :b])
end