diff options
Diffstat (limited to 'bin/ai')
-rw-r--r-- | bin/ai/regression/regression.nut | 30 | ||||
-rw-r--r-- | bin/ai/regression/regression.txt | 8 |
2 files changed, 38 insertions, 0 deletions
diff --git a/bin/ai/regression/regression.nut b/bin/ai/regression/regression.nut index 69019f04f..c27929d6b 100644 --- a/bin/ai/regression/regression.nut +++ b/bin/ai/regression/regression.nut @@ -785,6 +785,36 @@ function Regression::List() list.Clear(); print(" IsEmpty(): " + list.IsEmpty()); + + for (local i = 0; i < 10; i++) { + list.AddItem(i, 5 + i / 2); + } + + local it = list.Begin(); + print(" " + it + " => " + list.GetValue(it) + " (" + list.HasNext() + ")"); + list.Sort(list.SORT_BY_VALUE, list.SORT_ASCENDING); + it = list.Next(); + print(" " + it + " => " + list.GetValue(it) + " (" + list.HasNext() + ")"); + + it = list.Begin(); + print(" " + it + " => " + list.GetValue(it) + " (" + list.HasNext() + ")"); + + list.SetValue(it + 1, -5); + it = list.Next(); + print(" " + it + " => " + list.GetValue(it) + " (" + list.HasNext() + ")"); + + list.RemoveValue(list.GetValue(it) + 1); + it = list.Next(); + print(" " + it + " => " + list.GetValue(it) + " (" + list.HasNext() + ")"); + + list.RemoveAboveValue(list.GetValue(it)); + it = list.Next(); + print(" " + it + " => " + list.GetValue(it) + " (" + list.HasNext() + ")"); + + while (list.HasNext()) { + it = list.Next(); + print(" " + it + " => " + list.GetValue(it)); + } } function Regression::Map() diff --git a/bin/ai/regression/regression.txt b/bin/ai/regression/regression.txt index aa45f1151..2b499f62c 100644 --- a/bin/ai/regression/regression.txt +++ b/bin/ai/regression/regression.txt @@ -569,6 +569,14 @@ []: 4000 => 50 IsEmpty(): true + 0 => 5 (true) +ERROR: Next() is invalid as Begin() is never called +ERROR: HasNext() is invalid as Begin() is never called + 0 => 5 (false) + 0 => 5 (true) + 2 => 6 (true) + 3 => 6 (true) + 9 => 0 (false) --Company-- SetName(): true |