SortedTreeTests - update comments, break up linq query for readability

This commit is contained in:
John Colvin committed 2018-10-29 23:56:08 -05:00
1 parent c8790f766a
commit e4ea5cd769
1 file changed
+10 -4
@@ -145,7 +145,7 @@ namespace bts.tests {
/// - clear_action is executed/verified after each step (for both ascending/descending tree).
/// 1) Constructor initialization - all items are properly added when passed in through the constructor
/// 2) Insert - all items are properly added via <see cref="SortedTree{T, TKey}.Insert(T)"/>
/// 3) AddAll - all items are properly added via <see cref="SortedTree{T, TKey}.AddAll(IEnumerable{T})"/>
/// 3) Reset - all items are properly added via <see cref="SortedTree{T, TKey}.Reset(IEnumerable{T})"/>
/// 4) Replace - all items are properly updated with a new value and/or parent via <see cref="SortedTree{T, TKey}.Replace(TKey, Func{T, T})"/>
// 1) Constructor Initialization
@@ -158,7 +158,7 @@ namespace bts.tests {
tree_desc.Insert(o);
}
assert_populated_then_clear();
// 3) AddAll
// 3) Reset
tree_asc.Reset(input);
tree_desc.Reset(input);
assert_populated_then_clear();
@@ -255,10 +255,16 @@ namespace bts.tests {
ndict.Add(k, node);
}
}
return (roots.OrderBy(n => n.value, comp).SelectMany(iterate_inner_vals).ToList(), new HashSet<int>(nursery_map.Values.SelectMany(d => d.Values.SelectMany(iterate_inner_vals)).Select(id)));
return (roots.OrderBy(n => n.value, comp)
.SelectMany(iterate_inner_vals).ToList(),
new HashSet<int>(nursery_map.Values
.SelectMany(d => d.Values.SelectMany(iterate_inner_vals))
.Select(id)));
// local methods
IEnumerable<Order> iterate_inner_vals(TestNode n) =>
new[] { n.value }.Concat(n.inner.Values.OrderBy(cn => cn.value, comp).SelectMany(iterate_inner_vals));
new[] { n.value }.Concat(
n.inner.Values.OrderBy(cn => cn.value, comp)
.SelectMany(iterate_inner_vals));
}
class TestNode {