Sfoglia il codice sorgente

Finished Justifier

Tig 1 anno fa
parent
commit
3f7159256c
2 ha cambiato i file con 393 aggiunte e 359 eliminazioni
  1. 82 54
      Terminal.Gui/Drawing/Justification.cs
  2. 311 305
      UnitTests/Drawing/JustifierTests.cs

+ 82 - 54
Terminal.Gui/Drawing/Justification.cs

@@ -1,75 +1,83 @@
 namespace Terminal.Gui;
 
 /// <summary>
-///     Controls how items are justified within a container. Used by <see cref="Justifier"/>.
+///     Controls how the <see cref="Justifier"/> justifies items within a container. 
 /// </summary>
 public enum Justification
 {
     /// <summary>
     ///     The items will be aligned to the left.
-    ///     The items will be arranged such that there is no more than <see cref="Justifier.MaxSpaceBetweenItems"/> space between each.
+    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
+    ///     each item.
     /// </summary>
     /// <example>
-    /// <c>
-    /// 111 2222 33333
-    /// </c>
+    ///     <c>
+    ///         111 2222 33333
+    ///     </c>
     /// </example>
     Left,
 
     /// <summary>
     ///     The items will be aligned to the right.
-    ///     The items will be arranged such that there is no more than <see cref="Justifier.MaxSpaceBetweenItems"/> space between each.
+    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
+    ///     each item.
     /// </summary>
     /// <example>
-    /// <c>
-    ///    111 2222 33333
-    /// </c>
+    ///     <c>
+    ///         111 2222 33333
+    ///     </c>
     /// </example>
     Right,
 
     /// <summary>
     ///     The group will be centered in the container.
     ///     If centering is not possible, the group will be left-justified.
-    ///     The items will be arranged such that there is no more than <see cref="Justifier.MaxSpaceBetweenItems"/> space between each.
+    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
+    ///     each item.
     /// </summary>
     /// <example>
-    /// <c>
-    ///    111 2222 33333
-    /// </c>
+    ///     <c>
+    ///         111 2222 33333
+    ///     </c>
     /// </example>
     Centered,
 
     /// <summary>
     ///     The items will be justified. Space will be added between the items such that the first item
     ///     is at the start and the right side of the last item against the end.
-    ///     The items will be arranged such that there is no more than <see cref="Justifier.MaxSpaceBetweenItems"/> space between each.
+    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
+    ///     each item.
     /// </summary>
     /// <example>
-    /// <c>
-    /// 111    2222     33333
-    /// </c>
+    ///     <c>
+    ///         111    2222     33333
+    ///     </c>
     /// </example>
     Justified,
 
     /// <summary>
-    ///    The first item will be aligned to the left and the remaining will aligned to the right with no more than <see cref="Justifier.MaxSpaceBetweenItems"/> between each.
+    ///     The first item will be aligned to the left and the remaining will aligned to the right.
+    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
+    ///     each item.
     /// </summary>
     /// <example>
-    /// <c>
-    /// 111        2222 33333
-    /// </c>
+    ///     <c>
+    ///         111        2222 33333
+    ///     </c>
     /// </example>
-    OneLeftRestRight,
+    FirstLeftRestRight,
 
     /// <summary>
-    ///    The last item will be aligned to right and the remaining will aligned to the left with no more than <see cref="Justifier.MaxSpaceBetweenItems"/> between each.
+    ///     The last item will be aligned to the right and the remaining will aligned to the left.
+    ///     Set <see cref="Justifier.PutSpaceBetweenItems"/> to <see langword="true"/> to ensure at least one space between
+    ///     each item.
     /// </summary>
     /// <example>
-    /// <c>
-    /// 111 2222        33333
-    /// </c>
+    ///     <c>
+    ///         111 2222        33333
+    ///     </c>
     /// </example>
-    OneRightRestLeft
+    LastRightRestLeft
 }
 
 /// <summary>
@@ -77,25 +85,34 @@ public enum Justification
 /// </summary>
 public class Justifier
 {
+    private int _maxSpaceBetweenItems;
+
     /// <summary>
-    /// Gets or sets the maximum space between items. The default is 0. For text, this is usually 1.
+    ///     Gets or sets whether <see cref="Justify"/> puts a space is placed between items. Default is <see langword="false"/>. If <see langword="true"/>, a space will be
+    ///     placed between each item, which is useful for
+    ///     justifying text.
     /// </summary>
-    public int MaxSpaceBetweenItems { get; set; } = 0;
+    public bool PutSpaceBetweenItems
+    {
+        get => _maxSpaceBetweenItems == 1;
+        set => _maxSpaceBetweenItems = value ? 1 : 0;
+    }
 
     /// <summary>
-    ///     Justifies the <paramref name="sizes"/> within a container <see cref="totalSize"/> wide based on the specified
+    ///     Takes a list of items and returns their positions when justified within a container <paramref name="totalSize"/> wide based on the specified
     ///     <see cref="Justification"/>.
     /// </summary>
-    /// <param name="sizes"></param>
-    /// <param name="justification"></param>
-    /// <param name="totalSize"></param>
-    /// <returns></returns>
+    /// <param name="sizes">The sizes of the items to justify.</param>
+    /// <param name="justification">The justification style.</param>
+    /// <param name="totalSize">The width of the container.</param>
+    /// <returns>The locations of the items, from left to right.</returns>
     public int [] Justify (int [] sizes, Justification justification, int totalSize)
     {
         if (sizes.Length == 0)
         {
-            return new int []{};
+            return new int [] { };
         }
+
         int totalItemsSize = sizes.Sum ();
 
         if (totalItemsSize > totalSize)
@@ -106,8 +123,9 @@ public class Justifier
         var positions = new int [sizes.Length];
         totalItemsSize = sizes.Sum (); // total size of items
         int totalGaps = sizes.Length - 1; // total gaps (MinimumSpaceBetweenItems)
-        int totalItemsAndSpaces = totalItemsSize + (totalGaps * MaxSpaceBetweenItems); // total size of items and spaces if we had enough room
-        int spaces = totalGaps * MaxSpaceBetweenItems; // We'll decrement this below to place one space between each item until we run out
+        int totalItemsAndSpaces = totalItemsSize + totalGaps * _maxSpaceBetweenItems; // total size of items and spaces if we had enough room
+        int spaces = totalGaps * _maxSpaceBetweenItems; // We'll decrement this below to place one space between each item until we run out
+
         if (totalItemsSize >= totalSize)
         {
             spaces = 0;
@@ -117,7 +135,6 @@ public class Justifier
             spaces = totalSize - totalItemsSize;
         }
 
-
         switch (justification)
         {
             case Justification.Left:
@@ -133,10 +150,11 @@ public class Justifier
                     if (i == 0)
                     {
                         positions [0] = 0; // first item position
+
                         continue;
                     }
 
-                    var spaceBefore = spaces-- > 0 ? MaxSpaceBetweenItems : 0;
+                    int spaceBefore = spaces-- > 0 ? _maxSpaceBetweenItems : 0;
 
                     // subsequent items are placed one space after the previous item
                     positions [i] = positions [i - 1] + sizes [i - 1] + spaceBefore;
@@ -153,7 +171,7 @@ public class Justifier
                         throw new ArgumentException ("The size of an item cannot be negative.");
                     }
 
-                    var spaceBefore = spaces-- > 0 ? MaxSpaceBetweenItems : 0;
+                    int spaceBefore = spaces-- > 0 ? _maxSpaceBetweenItems : 0;
 
                     positions [i] = currentPosition;
                     currentPosition += sizes [i] + spaceBefore;
@@ -165,7 +183,7 @@ public class Justifier
                 if (sizes.Length > 1)
                 {
                     // remaining space to be distributed before first and after the items
-                    int remainingSpace = Math.Max(0, totalSize - totalItemsSize - spaces);
+                    int remainingSpace = Math.Max (0, totalSize - totalItemsSize - spaces);
 
                     for (var i = 0; i < sizes.Length; i++)
                     {
@@ -181,7 +199,7 @@ public class Justifier
                             continue;
                         }
 
-                        var spaceBefore = spaces-- > 0 ? MaxSpaceBetweenItems : 0;
+                        int spaceBefore = spaces-- > 0 ? _maxSpaceBetweenItems : 0;
 
                         // subsequent items are placed one space after the previous item
                         positions [i] = positions [i - 1] + sizes [i - 1] + spaceBefore;
@@ -193,32 +211,37 @@ public class Justifier
                     {
                         throw new ArgumentException ("The size of an item cannot be negative.");
                     }
+
                     positions [0] = (totalSize - sizes [0]) / 2; // single item is centered
                 }
-                break;
 
+                break;
 
             case Justification.Justified:
                 int spaceBetween = sizes.Length > 1 ? (totalSize - totalItemsSize) / (sizes.Length - 1) : 0;
                 int remainder = sizes.Length > 1 ? (totalSize - totalItemsSize) % (sizes.Length - 1) : 0;
                 currentPosition = 0;
+
                 for (var i = 0; i < sizes.Length; i++)
                 {
                     if (sizes [i] < 0)
                     {
                         throw new ArgumentException ("The size of an item cannot be negative.");
                     }
+
                     positions [i] = currentPosition;
                     int extraSpace = i < remainder ? 1 : 0;
                     currentPosition += sizes [i] + spaceBetween + extraSpace;
                 }
+
                 break;
 
-            /// 111 2222        33333
-            case Justification.OneRightRestLeft:
+            // 111 2222        33333
+            case Justification.LastRightRestLeft:
                 if (sizes.Length > 1)
                 {
                     currentPosition = 0;
+
                     for (var i = 0; i < sizes.Length; i++)
                     {
                         if (sizes [i] < 0)
@@ -228,12 +251,13 @@ public class Justifier
 
                         if (i < sizes.Length - 1)
                         {
-                            var spaceBefore = spaces-- > 0 ? MaxSpaceBetweenItems : 0;
+                            int spaceBefore = spaces-- > 0 ? _maxSpaceBetweenItems : 0;
 
                             positions [i] = currentPosition;
-                            currentPosition += sizes [i] + spaceBefore; 
+                            currentPosition += sizes [i] + spaceBefore;
                         }
                     }
+
                     positions [sizes.Length - 1] = totalSize - sizes [sizes.Length - 1];
                 }
                 else if (sizes.Length == 1)
@@ -242,18 +266,20 @@ public class Justifier
                     {
                         throw new ArgumentException ("The size of an item cannot be negative.");
                     }
+
                     positions [0] = totalSize - sizes [0]; // single item is flush right
                 }
+
                 break;
 
-            /// 111        2222 33333
-            case Justification.OneLeftRestRight:
+            // 111        2222 33333
+            case Justification.FirstLeftRestRight:
                 if (sizes.Length > 1)
                 {
                     currentPosition = 0;
                     positions [0] = currentPosition; // first item is flush left
 
-                    for (var i = sizes.Length - 1 ; i >= 0; i--)
+                    for (int i = sizes.Length - 1; i >= 0; i--)
                     {
                         if (sizes [i] < 0)
                         {
@@ -269,10 +295,10 @@ public class Justifier
 
                         if (i < sizes.Length - 1 && i > 0)
                         {
-                            var spaceBefore = spaces-- > 0 ? MaxSpaceBetweenItems : 0;
+                            int spaceBefore = spaces-- > 0 ? _maxSpaceBetweenItems : 0;
 
                             positions [i] = currentPosition - sizes [i] - spaceBefore;
-                            currentPosition -= sizes [i + 1];
+                            currentPosition = positions [i];
                         }
                     }
                 }
@@ -282,12 +308,14 @@ public class Justifier
                     {
                         throw new ArgumentException ("The size of an item cannot be negative.");
                     }
+
                     positions [0] = 0; // single item is flush left
                 }
-                break;
-
 
+                break;
 
+            default:
+                throw new ArgumentOutOfRangeException (nameof (justification), justification, null);
         }
 
         return positions;

+ 311 - 305
UnitTests/Drawing/JustifierTests.cs

@@ -1,20 +1,17 @@
-
 using System.Text;
 using Xunit.Abstractions;
-using Xunit.Sdk;
 
 namespace Terminal.Gui.DrawingTests;
 
 public class JustifierTests (ITestOutputHelper output)
 {
-
     private readonly ITestOutputHelper _output = output;
 
     public static IEnumerable<object []> JustificationEnumValues ()
     {
-        foreach (var number in Enum.GetValues (typeof (Justification)))
+        foreach (object number in Enum.GetValues (typeof (Justification)))
         {
-            yield return new object [] { number };
+            yield return new [] { number };
         }
     }
 
@@ -23,7 +20,7 @@ public class JustifierTests (ITestOutputHelper output)
     public void NoItems_Works (Justification justification)
     {
         int [] sizes = { };
-        var positions = new Justifier ().Justify (sizes, justification, 100);
+        int [] positions = new Justifier ().Justify (sizes, justification, 100);
         Assert.Equal (new int [] { }, positions);
     }
 
@@ -39,308 +36,314 @@ public class JustifierTests (ITestOutputHelper output)
     [MemberData (nameof (JustificationEnumValues))]
     public void Negative_Widths_Not_Allowed (Justification justification)
     {
-        Assert.Throws<ArgumentException> (() => new Justifier ().Justify (new int [] { -10, 20, 30 }, justification, 100));
-        Assert.Throws<ArgumentException> (() => new Justifier ().Justify (new int [] { 10, -20, 30 }, justification, 100));
-        Assert.Throws<ArgumentException> (() => new Justifier ().Justify (new int [] { 10, 20, -30 }, justification, 100));
+        Assert.Throws<ArgumentException> (() => new Justifier ().Justify (new [] { -10, 20, 30 }, justification, 100));
+        Assert.Throws<ArgumentException> (() => new Justifier ().Justify (new [] { 10, -20, 30 }, justification, 100));
+        Assert.Throws<ArgumentException> (() => new Justifier ().Justify (new [] { 10, 20, -30 }, justification, 100));
     }
 
     [Theory]
-    [InlineData (Justification.Left, new int [] { 0 }, 1, new int [] { 0 })]
-    [InlineData (Justification.Left, new int [] { 0, 0 }, 1, new int [] { 0, 1 })]
-    [InlineData (Justification.Left, new int [] { 0, 0, 0 }, 1, new int [] { 0, 1, 1 })]
-    [InlineData (Justification.Left, new int [] { 1 }, 1, new int [] { 0 })]
-    [InlineData (Justification.Left, new int [] { 1 }, 2, new int [] { 0 })]
-    [InlineData (Justification.Left, new int [] { 1 }, 3, new int [] { 0 })]
-    [InlineData (Justification.Left, new int [] { 1, 1 }, 2, new int [] { 0, 1 })]
-    [InlineData (Justification.Left, new int [] { 1, 1 }, 3, new int [] { 0, 2 })]
-    [InlineData (Justification.Left, new int [] { 1, 1 }, 4, new int [] { 0, 2 })]
-    [InlineData (Justification.Left, new int [] { 1, 1, 1 }, 3, new int [] { 0, 1, 2 })]
-    [InlineData (Justification.Left, new int [] { 1, 2, 3 }, 6, new int [] { 0, 1, 3 })]
-    [InlineData (Justification.Left, new int [] { 1, 2, 3 }, 7, new int [] { 0, 2, 4 })]
-    [InlineData (Justification.Left, new int [] { 1, 2, 3 }, 10, new int [] { 0, 2, 5 })]
-    [InlineData (Justification.Left, new int [] { 1, 2, 3 }, 11, new int [] { 0, 2, 5 })]
-    [InlineData (Justification.Left, new int [] { 1, 2, 3 }, 12, new int [] { 0, 2, 5 })]
-    [InlineData (Justification.Left, new int [] { 1, 2, 3 }, 13, new int [] { 0, 2, 5 })]
-    [InlineData (Justification.Left, new int [] { 1, 2, 3, 4 }, 10, new int [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.Left, new int [] { 1, 2, 3, 4 }, 11, new int [] { 0, 2, 4, 7 })]
-    [InlineData (Justification.Left, new int [] { 33, 33, 33 }, 100, new int [] { 0, 34, 67 })]
-    [InlineData (Justification.Left, new int [] { 10 }, 101, new int [] { 0 })]
-    [InlineData (Justification.Left, new int [] { 10, 20 }, 101, new int [] { 0, 11 })]
-    [InlineData (Justification.Left, new int [] { 10, 20, 30 }, 100, new int [] { 0, 11, 32 })]
-    [InlineData (Justification.Left, new int [] { 10, 20, 30 }, 101, new int [] { 0, 11, 32 })]
-    [InlineData (Justification.Left, new int [] { 10, 20, 30, 40 }, 101, new int [] { 0, 11, 31, 61 })]
-    [InlineData (Justification.Left, new int [] { 10, 20, 30, 40, 50 }, 151, new int [] { 0, 11, 31, 61, 101 })]
-
-    [InlineData (Justification.Right, new int [] { 0 }, 1, new int [] { 1 })]
-    [InlineData (Justification.Right, new int [] { 0, 0 }, 1, new int [] { 0, 1 })]
-    [InlineData (Justification.Right, new int [] { 0, 0, 0 }, 1, new int [] { 0, 1, 1 })]
-    [InlineData (Justification.Right, new int [] { 1, 2, 3 }, 6, new int [] { 0, 1, 3 })]
-    [InlineData (Justification.Right, new int [] { 1, 2, 3 }, 7, new int [] { 0, 2, 4 })]
-    [InlineData (Justification.Right, new int [] { 1, 2, 3 }, 10, new int [] { 2, 4, 7 })]
-    [InlineData (Justification.Right, new int [] { 1, 2, 3 }, 11, new int [] { 3, 5, 8 })]
-    [InlineData (Justification.Right, new int [] { 1, 2, 3 }, 12, new int [] { 4, 6, 9 })]
-    [InlineData (Justification.Right, new int [] { 1, 2, 3 }, 13, new int [] { 5, 7, 10 })]
-    [InlineData (Justification.Right, new int [] { 1, 2, 3, 4 }, 10, new int [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.Right, new int [] { 1, 2, 3, 4 }, 11, new int [] { 0, 2, 4, 7 })]
-    [InlineData (Justification.Right, new int [] { 10, 20, 30 }, 100, new int [] { 38, 49, 70 })]
-    [InlineData (Justification.Right, new int [] { 33, 33, 33 }, 100, new int [] { 0, 34, 67 })]
-    [InlineData (Justification.Right, new int [] { 10 }, 101, new int [] { 91 })]
-    [InlineData (Justification.Right, new int [] { 10, 20 }, 101, new int [] { 70, 81 })]
-    [InlineData (Justification.Right, new int [] { 10, 20, 30 }, 101, new int [] { 39, 50, 71 })]
-    [InlineData (Justification.Right, new int [] { 10, 20, 30, 40 }, 101, new int [] { 0, 11, 31, 61 })]
-    [InlineData (Justification.Right, new int [] { 10, 20, 30, 40, 50 }, 151, new int [] { 0, 11, 31, 61, 101 })]
-
-    [InlineData (Justification.Centered, new int [] { 0 }, 1, new int [] { 0 })]
-    [InlineData (Justification.Centered, new int [] { 0, 0 }, 1, new int [] { 0, 1 })]
-    [InlineData (Justification.Centered, new int [] { 0, 0, 0 }, 1, new int [] { 0, 1, 1 })]
-    [InlineData (Justification.Centered, new int [] { 1 }, 1, new int [] { 0 })]
-    [InlineData (Justification.Centered, new int [] { 1 }, 2, new int [] { 0 })]
-    [InlineData (Justification.Centered, new int [] { 1 }, 3, new int [] { 1 })]
-    [InlineData (Justification.Centered, new int [] { 1, 1 }, 2, new int [] { 0, 1 })]
-    [InlineData (Justification.Centered, new int [] { 1, 1 }, 3, new int [] { 0, 2 })]
-    [InlineData (Justification.Centered, new int [] { 1, 1 }, 4, new int [] { 0, 2 })]
-    [InlineData (Justification.Centered, new int [] { 1, 1, 1 }, 3, new int [] { 0, 1, 2 })]
-    [InlineData (Justification.Centered, new int [] { 1, 2, 3 }, 6, new int [] { 0, 1, 3 })]
-    [InlineData (Justification.Centered, new int [] { 1, 2, 3 }, 7, new int [] { 0, 2, 4 })]
-    [InlineData (Justification.Centered, new int [] { 1, 2, 3 }, 10, new int [] { 1, 3, 6 })]
-    [InlineData (Justification.Centered, new int [] { 1, 2, 3 }, 11, new int [] { 1, 3, 6 })]
-    [InlineData (Justification.Centered, new int [] { 1, 2, 3, 4 }, 10, new int [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.Centered, new int [] { 1, 2, 3, 4 }, 11, new int [] { 0, 2, 4, 7 })]
-    [InlineData (Justification.Centered, new int [] { 3, 3, 3 }, 9, new int [] { 0, 3, 6 })]
-    [InlineData (Justification.Centered, new int [] { 3, 3, 3 }, 10, new int [] { 0, 4, 7 })]
-    [InlineData (Justification.Centered, new int [] { 3, 3, 3 }, 11, new int [] { 0, 4, 8 })]
-    [InlineData (Justification.Centered, new int [] { 3, 3, 3 }, 12, new int [] { 0, 4, 8 })]
-    [InlineData (Justification.Centered, new int [] { 3, 3, 3 }, 13, new int [] { 1, 5, 9 })]
-    [InlineData (Justification.Centered, new int [] { 33, 33, 33 }, 100, new int [] { 0, 34, 67 })]
-    [InlineData (Justification.Centered, new int [] { 33, 33, 33 }, 101, new int [] { 0, 34, 68 })]
-    [InlineData (Justification.Centered, new int [] { 33, 33, 33 }, 102, new int [] { 0, 34, 68 })]
-    [InlineData (Justification.Centered, new int [] { 33, 33, 33 }, 103, new int [] { 1, 35, 69 })]
-    [InlineData (Justification.Centered, new int [] { 33, 33, 33 }, 104, new int [] { 1, 35, 69 })]
-    [InlineData (Justification.Centered, new int [] { 10 }, 101, new int [] { 45 })]
-    [InlineData (Justification.Centered, new int [] { 10, 20 }, 101, new int [] { 35, 46 })]
-    [InlineData (Justification.Centered, new int [] { 10, 20, 30 }, 100, new int [] { 19, 30, 51 })]
-    [InlineData (Justification.Centered, new int [] { 10, 20, 30 }, 101, new int [] { 19, 30, 51 })]
-    [InlineData (Justification.Centered, new int [] { 10, 20, 30, 40 }, 100, new int [] { 0, 10, 30, 60 })]
-    [InlineData (Justification.Centered, new int [] { 10, 20, 30, 40 }, 101, new int [] { 0, 11, 31, 61 })]
-    [InlineData (Justification.Centered, new int [] { 10, 20, 30, 40, 50 }, 151, new int [] { 0, 11, 31, 61, 101 })]
-    [InlineData (Justification.Centered, new int [] { 3, 4, 5, 6 }, 25, new int [] { 2, 6, 11, 17 })]
-
-    [InlineData (Justification.Justified, new int [] { 10, 20, 30, 40, 50 }, 151, new int [] { 0, 11, 31, 61, 101 })]
-    [InlineData (Justification.Justified, new int [] { 10, 20, 30, 40 }, 101, new int [] { 0, 11, 31, 61 })]
-    [InlineData (Justification.Justified, new int [] { 10, 20, 30 }, 100, new int [] { 0, 30, 70 })]
-    [InlineData (Justification.Justified, new int [] { 10, 20, 30 }, 101, new int [] { 0, 31, 71 })]
-    [InlineData (Justification.Justified, new int [] { 33, 33, 33 }, 100, new int [] { 0, 34, 67 })]
-    [InlineData (Justification.Justified, new int [] { 11, 17, 23 }, 100, new int [] { 0, 36, 77 })]
-    [InlineData (Justification.Justified, new int [] { 1, 2, 3 }, 11, new int [] { 0, 4, 8 })]
-    [InlineData (Justification.Justified, new int [] { 10, 20 }, 101, new int [] { 0, 81 })]
-    [InlineData (Justification.Justified, new int [] { 10 }, 101, new int [] { 0 })]
-    [InlineData (Justification.Justified, new int [] { 3, 3, 3 }, 21, new int [] { 0, 9, 18 })]
-    [InlineData (Justification.Justified, new int [] { 3, 4, 5 }, 21, new int [] { 0, 8, 16 })]
-    [InlineData (Justification.Justified, new int [] { 3, 4, 5, 6 }, 18, new int [] { 0, 3, 7, 12 })]
-    [InlineData (Justification.Justified, new int [] { 3, 4, 5, 6 }, 19, new int [] { 0, 4, 8, 13 })]
-    [InlineData (Justification.Justified, new int [] { 3, 4, 5, 6 }, 20, new int [] { 0, 4, 9, 14 })]
-    [InlineData (Justification.Justified, new int [] { 3, 4, 5, 6 }, 21, new int [] { 0, 4, 9, 15 })]
-    [InlineData (Justification.Justified, new int [] { 6, 5, 4, 3 }, 22, new int [] { 0, 8, 14, 19 })]
-    [InlineData (Justification.Justified, new int [] { 6, 5, 4, 3 }, 23, new int [] { 0, 8, 15, 20, })]
-    [InlineData (Justification.Justified, new int [] { 6, 5, 4, 3 }, 24, new int [] { 0, 8, 15, 21 })]
-    [InlineData (Justification.Justified, new int [] { 6, 5, 4, 3 }, 25, new int [] { 0, 9, 16, 22 })]
-    [InlineData (Justification.Justified, new int [] { 6, 5, 4, 3 }, 26, new int [] { 0, 9, 17, 23 })]
-    [InlineData (Justification.Justified, new int [] { 6, 5, 4, 3 }, 31, new int [] { 0, 11, 20, 28 })]
-
-    [InlineData (Justification.OneRightRestLeft, new int [] { 0 }, 1, new int [] { 0 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 0, 0 }, 1, new int [] { 0, 1 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 0, 0, 0 }, 1, new int [] { 0, 1, 1 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1 }, 1, new int [] { 0 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1 }, 2, new int [] { 0 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1 }, 3, new int [] { 0 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1, 1 }, 2, new int [] { 0, 1 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1, 1 }, 3, new int [] { 0, 2 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1, 1 }, 4, new int [] { 0, 3 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1, 1, 1 }, 3, new int [] { 0, 1, 2 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3 }, 6, new int [] { 0, 1, 3 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3 }, 7, new int [] { 0, 2, 4 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3 }, 8, new int [] { 0, 2, 5 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3 }, 9, new int [] { 0, 2, 6 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3 }, 10, new int [] { 0, 2, 7 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3 }, 11, new int [] { 0, 2, 8 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3, 4 }, 10, new int [] { 0, 1, 3, 6 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3, 4 }, 11, new int [] { 0, 2, 4, 7 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 3, 3, 3 }, 21, new int [] { 0, 4, 18 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 3, 4, 5 }, 21, new int [] { 0, 4, 16 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 33, 33, 33 }, 100, new int [] { 0, 34, 67 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 10 }, 101, new int [] { 0 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 10, 20 }, 101, new int [] { 0, 81 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 10, 20, 30 }, 100, new int [] { 0, 11, 70 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 10, 20, 30 }, 101, new int [] { 0, 11, 71 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 10, 20, 30, 40 }, 101, new int [] { 0, 11, 31, 61 })]
-    [InlineData (Justification.OneRightRestLeft, new int [] { 10, 20, 30, 40, 50 }, 151, new int [] { 0, 11, 31, 61, 101 })]
-
-    //[InlineData (Justification.SplitLeft, new int [] { 10, 20, 30 }, 100, new int [] { 0, 49, 70 })]
-    //[InlineData (Justification.SplitLeft, new int [] { 33, 33, 33 }, 100, new int [] { 0, 33, 67 })]
-    //[InlineData (Justification.SplitLeft, new int [] { 10 }, 101, new int [] { 0 })]
-    //[InlineData (Justification.SplitLeft, new int [] { 10, 20 }, 101, new int [] { 0, 81 })]
-    //[InlineData (Justification.SplitLeft, new int [] { 10, 20, 30 }, 101, new int [] { 0, 50, 71 })]
-    //[InlineData (Justification.SplitLeft, new int [] { 10, 20, 30, 40 }, 101, new int [] { 0, 9, 30, 61 })]
-    //[InlineData (Justification.SplitLeft, new int [] { 10, 20, 30, 40, 50 }, 151, new int [] { 0, 8, 29, 60, 101 })]
-    //[InlineData (Justification.SplitLeft, new int [] { 3, 3, 3 }, 21, new int [] { 0, 14, 18 })]
-    //[InlineData (Justification.SplitLeft, new int [] { 3, 4, 5 }, 21, new int [] { 0, 11, 16 })]
-
-    public void TestJustifications_1Space (Justification justification, int [] sizes, int totalSize, int [] expected)
+    [InlineData (Justification.Left, new [] { 0 }, 1, new [] { 0 })]
+    [InlineData (Justification.Left, new [] { 0, 0 }, 1, new [] { 0, 1 })]
+    [InlineData (Justification.Left, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
+    [InlineData (Justification.Left, new [] { 1 }, 1, new [] { 0 })]
+    [InlineData (Justification.Left, new [] { 1 }, 2, new [] { 0 })]
+    [InlineData (Justification.Left, new [] { 1 }, 3, new [] { 0 })]
+    [InlineData (Justification.Left, new [] { 1, 1 }, 2, new [] { 0, 1 })]
+    [InlineData (Justification.Left, new [] { 1, 1 }, 3, new [] { 0, 2 })]
+    [InlineData (Justification.Left, new [] { 1, 1 }, 4, new [] { 0, 2 })]
+    [InlineData (Justification.Left, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 10, new [] { 0, 2, 5 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 11, new [] { 0, 2, 5 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 12, new [] { 0, 2, 5 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 13, new [] { 0, 2, 5 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
+    [InlineData (Justification.Left, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
+    [InlineData (Justification.Left, new [] { 10 }, 101, new [] { 0 })]
+    [InlineData (Justification.Left, new [] { 10, 20 }, 101, new [] { 0, 11 })]
+    [InlineData (Justification.Left, new [] { 10, 20, 30 }, 100, new [] { 0, 11, 32 })]
+    [InlineData (Justification.Left, new [] { 10, 20, 30 }, 101, new [] { 0, 11, 32 })]
+    [InlineData (Justification.Left, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
+    [InlineData (Justification.Left, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
+    [InlineData (Justification.Right, new [] { 0 }, 1, new [] { 1 })]
+    [InlineData (Justification.Right, new [] { 0, 0 }, 1, new [] { 0, 1 })]
+    [InlineData (Justification.Right, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 10, new [] { 2, 4, 7 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 11, new [] { 3, 5, 8 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 12, new [] { 4, 6, 9 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 13, new [] { 5, 7, 10 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
+    [InlineData (Justification.Right, new [] { 10, 20, 30 }, 100, new [] { 38, 49, 70 })]
+    [InlineData (Justification.Right, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
+    [InlineData (Justification.Right, new [] { 10 }, 101, new [] { 91 })]
+    [InlineData (Justification.Right, new [] { 10, 20 }, 101, new [] { 70, 81 })]
+    [InlineData (Justification.Right, new [] { 10, 20, 30 }, 101, new [] { 39, 50, 71 })]
+    [InlineData (Justification.Right, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
+    [InlineData (Justification.Right, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
+    [InlineData (Justification.Centered, new [] { 0 }, 1, new [] { 0 })]
+    [InlineData (Justification.Centered, new [] { 0, 0 }, 1, new [] { 0, 1 })]
+    [InlineData (Justification.Centered, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
+    [InlineData (Justification.Centered, new [] { 1 }, 1, new [] { 0 })]
+    [InlineData (Justification.Centered, new [] { 1 }, 2, new [] { 0 })]
+    [InlineData (Justification.Centered, new [] { 1 }, 3, new [] { 1 })]
+    [InlineData (Justification.Centered, new [] { 1, 1 }, 2, new [] { 0, 1 })]
+    [InlineData (Justification.Centered, new [] { 1, 1 }, 3, new [] { 0, 2 })]
+    [InlineData (Justification.Centered, new [] { 1, 1 }, 4, new [] { 0, 2 })]
+    [InlineData (Justification.Centered, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
+    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
+    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 10, new [] { 1, 3, 6 })]
+    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 11, new [] { 1, 3, 6 })]
+    [InlineData (Justification.Centered, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Justification.Centered, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
+    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 9, new [] { 0, 3, 6 })]
+    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 10, new [] { 0, 4, 7 })]
+    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 11, new [] { 0, 4, 8 })]
+    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 12, new [] { 0, 4, 8 })]
+    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 13, new [] { 1, 5, 9 })]
+    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
+    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 101, new [] { 0, 34, 68 })]
+    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 102, new [] { 0, 34, 68 })]
+    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 103, new [] { 1, 35, 69 })]
+    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 104, new [] { 1, 35, 69 })]
+    [InlineData (Justification.Centered, new [] { 10 }, 101, new [] { 45 })]
+    [InlineData (Justification.Centered, new [] { 10, 20 }, 101, new [] { 35, 46 })]
+    [InlineData (Justification.Centered, new [] { 10, 20, 30 }, 100, new [] { 19, 30, 51 })]
+    [InlineData (Justification.Centered, new [] { 10, 20, 30 }, 101, new [] { 19, 30, 51 })]
+    [InlineData (Justification.Centered, new [] { 10, 20, 30, 40 }, 100, new [] { 0, 10, 30, 60 })]
+    [InlineData (Justification.Centered, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
+    [InlineData (Justification.Centered, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
+    [InlineData (Justification.Centered, new [] { 3, 4, 5, 6 }, 25, new [] { 2, 6, 11, 17 })]
+    [InlineData (Justification.Justified, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
+    [InlineData (Justification.Justified, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
+    [InlineData (Justification.Justified, new [] { 10, 20, 30 }, 100, new [] { 0, 30, 70 })]
+    [InlineData (Justification.Justified, new [] { 10, 20, 30 }, 101, new [] { 0, 31, 71 })]
+    [InlineData (Justification.Justified, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
+    [InlineData (Justification.Justified, new [] { 11, 17, 23 }, 100, new [] { 0, 36, 77 })]
+    [InlineData (Justification.Justified, new [] { 1, 2, 3 }, 11, new [] { 0, 4, 8 })]
+    [InlineData (Justification.Justified, new [] { 10, 20 }, 101, new [] { 0, 81 })]
+    [InlineData (Justification.Justified, new [] { 10 }, 101, new [] { 0 })]
+    [InlineData (Justification.Justified, new [] { 3, 3, 3 }, 21, new [] { 0, 9, 18 })]
+    [InlineData (Justification.Justified, new [] { 3, 4, 5 }, 21, new [] { 0, 8, 16 })]
+    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 18, new [] { 0, 3, 7, 12 })]
+    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 19, new [] { 0, 4, 8, 13 })]
+    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 20, new [] { 0, 4, 9, 14 })]
+    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 21, new [] { 0, 4, 9, 15 })]
+    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 22, new [] { 0, 8, 14, 19 })]
+    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 23, new [] { 0, 8, 15, 20 })]
+    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 24, new [] { 0, 8, 15, 21 })]
+    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 25, new [] { 0, 9, 16, 22 })]
+    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 26, new [] { 0, 9, 17, 23 })]
+    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 31, new [] { 0, 11, 20, 28 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 0 }, 1, new [] { 1 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 0, 0 }, 1, new [] { 0, 1 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1 }, 1, new [] { 0 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1 }, 2, new [] { 1 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1 }, 3, new [] { 2 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1 }, 2, new [] { 0, 1 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1 }, 3, new [] { 0, 2 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1 }, 4, new [] { 0, 3 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 8, new [] { 0, 2, 5 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 9, new [] { 0, 2, 6 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 10, new [] { 0, 2, 7 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 11, new [] { 0, 2, 8 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 3, 3, 3 }, 21, new [] { 0, 4, 18 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 3, 4, 5 }, 21, new [] { 0, 4, 16 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 10 }, 101, new [] { 91 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20 }, 101, new [] { 0, 81 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30 }, 100, new [] { 0, 11, 70 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30 }, 101, new [] { 0, 11, 71 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 0 }, 1, new [] { 0 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 0, 0 }, 1, new [] { 0, 1 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 0, 0, 0 }, 1, new [] { 0, 0, 1 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1 }, 1, new [] { 0 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1 }, 2, new [] { 0 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1 }, 3, new [] { 0 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1 }, 2, new [] { 0, 1 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1 }, 3, new [] { 0, 2 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1 }, 4, new [] { 0, 3 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 7, new [] { 0, 1, 4 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 8, new [] { 0, 2, 5 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 9, new [] { 0, 3, 6 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 10, new [] { 0, 4, 7 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 11, new [] { 0, 5, 8 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 1, 3, 7 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 12, new [] { 0, 1, 4, 8 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 3, 3, 3 }, 21, new [] { 0, 14, 18 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 3, 4, 5 }, 21, new [] { 0, 11, 16 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 33, 33, 33 }, 100, new [] { 0, 33, 67 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 10 }, 101, new [] { 0 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20 }, 101, new [] { 0, 81 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30 }, 100, new [] { 0, 49, 70 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30 }, 101, new [] { 0, 50, 71 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 10, 30, 61 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 10, 30, 60, 101 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 3, 3, 3 }, 21, new [] { 0, 14, 18 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 3, 4, 5 }, 21, new [] { 0, 11, 16 })]
+    public void TestJustifications_PutSpaceBetweenItems (Justification justification, int [] sizes, int totalSize, int [] expected)
     {
-        var positions = new Justifier () { MaxSpaceBetweenItems = 1 }.Justify (sizes, justification, totalSize);
+        int [] positions = new Justifier { PutSpaceBetweenItems = true }.Justify (sizes, justification, totalSize);
         AssertJustification (justification, sizes, totalSize, positions, expected);
     }
 
     [Theory]
-    //[InlineData (Justification.Left, new int [] { 0 }, 1, new int [] { 0 })]
-    //[InlineData (Justification.Left, new int [] { 0, 0 }, 1, new int [] { 0, 0 })]
-    //[InlineData (Justification.Left, new int [] { 0, 0, 0 }, 1, new int [] { 0, 0, 0 })]
-    //[InlineData (Justification.Left, new int [] { 1, 2, 3 }, 6, new int [] { 0, 1, 3 })]
-    //[InlineData (Justification.Left, new int [] { 1, 2, 3 }, 7, new int [] { 0, 1, 3 })]
-    //[InlineData (Justification.Left, new int [] { 1, 2, 3 }, 10, new int [] { 0, 1, 3 })]
-    //[InlineData (Justification.Left, new int [] { 1, 2, 3 }, 11, new int [] { 0, 1, 3 })]
-    //[InlineData (Justification.Left, new int [] { 1, 2, 3 }, 12, new int [] { 0, 1, 3 })]
-    //[InlineData (Justification.Left, new int [] { 1, 2, 3 }, 13, new int [] { 0, 1, 3 })]
-    //[InlineData (Justification.Left, new int [] { 1, 2, 3, 4 }, 10, new int [] { 0, 1, 3, 6 })]
-    //[InlineData (Justification.Left, new int [] { 1, 2, 3, 4 }, 11, new int [] { 0, 1, 3, 6 })]
-    //[InlineData (Justification.Left, new int [] { 10, 20, 30 }, 100, new int [] { 0, 10, 30 })]
-    //[InlineData (Justification.Left, new int [] { 33, 33, 33 }, 100, new int [] { 0, 33, 66 })]
-    //[InlineData (Justification.Left, new int [] { 10 }, 101, new int [] { 0 })]
-    //[InlineData (Justification.Left, new int [] { 10, 20 }, 101, new int [] { 0, 10 })]
-    //[InlineData (Justification.Left, new int [] { 10, 20, 30 }, 101, new int [] { 0, 10, 30 })]
-    //[InlineData (Justification.Left, new int [] { 10, 20, 30, 40 }, 101, new int [] { 0, 10, 30, 60 })]
-    //[InlineData (Justification.Left, new int [] { 10, 20, 30, 40, 50 }, 151, new int [] { 0, 10, 30, 60, 100 })]
-
-    //[InlineData (Justification.Right, new int [] { 0 }, 1, new int [] { 1 })]
-    //[InlineData (Justification.Right, new int [] { 0, 0 }, 1, new int [] { 1, 1 })]
-    //[InlineData (Justification.Right, new int [] { 0, 0, 0 }, 1, new int [] { 1, 1, 1 })]
-    //[InlineData (Justification.Right, new int [] { 1, 2, 3 }, 6, new int [] { 0, 1, 3 })]
-    //[InlineData (Justification.Right, new int [] { 1, 2, 3 }, 7, new int [] { 1, 2, 4 })]
-    //[InlineData (Justification.Right, new int [] { 1, 2, 3 }, 10, new int [] { 4, 5, 7 })]
-    //[InlineData (Justification.Right, new int [] { 1, 2, 3 }, 11, new int [] { 5, 6, 8 })]
-    //[InlineData (Justification.Right, new int [] { 1, 2, 3 }, 12, new int [] { 6, 7, 9 })]
-    //[InlineData (Justification.Right, new int [] { 1, 2, 3 }, 13, new int [] { 7, 8, 10 })]
-    //[InlineData (Justification.Right, new int [] { 1, 2, 3, 4 }, 10, new int [] { 0, 1, 3, 6 })]
-    //[InlineData (Justification.Right, new int [] { 1, 2, 3, 4 }, 11, new int [] { 1, 2, 4, 7 })]
-    //[InlineData (Justification.Right, new int [] { 10, 20, 30 }, 100, new int [] { 40, 50, 70 })]
-    //[InlineData (Justification.Right, new int [] { 33, 33, 33 }, 100, new int [] { 1, 34, 67 })]
-    //[InlineData (Justification.Right, new int [] { 10 }, 101, new int [] { 91 })]
-    //[InlineData (Justification.Right, new int [] { 10, 20 }, 101, new int [] { 71, 81 })]
-    //[InlineData (Justification.Right, new int [] { 10, 20, 30 }, 101, new int [] { 41, 51, 71 })]
-    //[InlineData (Justification.Right, new int [] { 10, 20, 30, 40 }, 101, new int [] { 1, 11, 31, 61 })]
-    //[InlineData (Justification.Right, new int [] { 10, 20, 30, 40, 50 }, 151, new int [] { 1, 11, 31, 61, 101 })]
-
-    //[InlineData (Justification.Centered, new int [] { 1 }, 1, new int [] { 0 })]
-    //[InlineData (Justification.Centered, new int [] { 1 }, 2, new int [] { 0 })]
-    //[InlineData (Justification.Centered, new int [] { 1 }, 3, new int [] { 1 })]
-    //[InlineData (Justification.Centered, new int [] { 1, 1 }, 2, new int [] { 0, 1 })]
-    //[InlineData (Justification.Centered, new int [] { 1, 1 }, 3, new int [] { 0, 1 })]
-    //[InlineData (Justification.Centered, new int [] { 1, 1 }, 4, new int [] { 1, 2 })]
-    //[InlineData (Justification.Centered, new int [] { 1, 1, 1 }, 3, new int [] { 0, 1, 2 })]
-    //[InlineData (Justification.Centered, new int [] { 1, 2, 3 }, 6, new int [] { 0, 1, 3 })]
-    //[InlineData (Justification.Centered, new int [] { 1, 2, 3 }, 7, new int [] { 0, 1, 3 })]
-    //[InlineData (Justification.Centered, new int [] { 1, 2, 3 }, 10, new int [] { 2, 3, 5 })]
-    //[InlineData (Justification.Centered, new int [] { 1, 2, 3 }, 11, new int [] { 2, 3, 5 })]
-    //[InlineData (Justification.Centered, new int [] { 1, 2, 3, 4 }, 10, new int [] { 0, 1, 3, 6 })]
-    //[InlineData (Justification.Centered, new int [] { 1, 2, 3, 4 }, 11, new int [] { 0, 1, 3, 6 })]
-    //[InlineData (Justification.Centered, new int [] { 3, 3, 3 }, 9, new int [] { 0, 3, 6 })]
-    //[InlineData (Justification.Centered, new int [] { 3, 3, 3 }, 10, new int [] { 0, 3, 6 })]
-    //[InlineData (Justification.Centered, new int [] { 3, 3, 3 }, 11, new int [] { 1, 4, 7 })]
-    //[InlineData (Justification.Centered, new int [] { 3, 3, 3 }, 12, new int [] { 1, 4, 7 })]
-    //[InlineData (Justification.Centered, new int [] { 3, 3, 3 }, 13, new int [] { 2, 5, 8 })]
-    //[InlineData (Justification.Centered, new int [] { 33, 33, 33 }, 100, new int [] { 0, 33, 66 })]
-    //[InlineData (Justification.Centered, new int [] { 33, 33, 33 }, 101, new int [] { 1, 34, 67 })]
-    //[InlineData (Justification.Centered, new int [] { 33, 33, 33 }, 102, new int [] { 1, 34, 67 })]
-    //[InlineData (Justification.Centered, new int [] { 33, 33, 33 }, 103, new int [] { 2, 35, 68 })]
-    //[InlineData (Justification.Centered, new int [] { 33, 33, 33 }, 104, new int [] { 2, 35, 68 })]
-    //[InlineData (Justification.Centered, new int [] { 3, 4, 5, 6 }, 25, new int [] { 3, 6, 10, 15 })]
-
-    //[InlineData (Justification.Justified, new int [] { 10, 20, 30, 40, 50 }, 151, new int [] { 0, 11, 31, 61, 101 })]
-    //[InlineData (Justification.Justified, new int [] { 10, 20, 30, 40 }, 101, new int [] { 0, 11, 31, 61 })]
-    //[InlineData (Justification.Justified, new int [] { 10, 20, 30 }, 100, new int [] { 0, 30, 70 })]
-    //[InlineData (Justification.Justified, new int [] { 10, 20, 30 }, 101, new int [] { 0, 31, 71 })]
-    //[InlineData (Justification.Justified, new int [] { 33, 33, 33 }, 100, new int [] { 0, 34, 67 })]
-    //[InlineData (Justification.Justified, new int [] { 11, 17, 23 }, 100, new int [] { 0, 36, 77 })]
-    //[InlineData (Justification.Justified, new int [] { 1, 2, 3 }, 11, new int [] { 0, 4, 8 })]
-    //[InlineData (Justification.Justified, new int [] { 10, 20 }, 101, new int [] { 0, 81 })]
-    //[InlineData (Justification.Justified, new int [] { 10 }, 101, new int [] { 0 })]
-    //[InlineData (Justification.Justified, new int [] { 3, 3, 3 }, 21, new int [] { 0, 9, 18 })]
-    //[InlineData (Justification.Justified, new int [] { 3, 4, 5 }, 21, new int [] { 0, 8, 16 })]
-    //[InlineData (Justification.Justified, new int [] { 3, 4, 5, 6 }, 18, new int [] { 0, 3, 7, 12 })]
-    //[InlineData (Justification.Justified, new int [] { 3, 4, 5, 6 }, 19, new int [] { 0, 4, 8, 13 })]
-    //[InlineData (Justification.Justified, new int [] { 3, 4, 5, 6 }, 20, new int [] { 0, 4, 9, 14 })]
-    //[InlineData (Justification.Justified, new int [] { 3, 4, 5, 6 }, 21, new int [] { 0, 4, 9, 15 })]
-    //[InlineData (Justification.Justified, new int [] { 6, 5, 4, 3 }, 22, new int [] { 0, 8, 14, 19 })]
-    //[InlineData (Justification.Justified, new int [] { 6, 5, 4, 3 }, 23, new int [] { 0, 8, 15, 20, })]
-    //[InlineData (Justification.Justified, new int [] { 6, 5, 4, 3 }, 24, new int [] { 0, 8, 15, 21 })]
-    //[InlineData (Justification.Justified, new int [] { 6, 5, 4, 3 }, 25, new int [] { 0, 9, 16, 22 })]
-    //[InlineData (Justification.Justified, new int [] { 6, 5, 4, 3 }, 26, new int [] { 0, 9, 17, 23 })]
-    //[InlineData (Justification.Justified, new int [] { 6, 5, 4, 3 }, 31, new int [] { 0, 11, 20, 28 })]
-
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 0 }, 1, new int [] { 0 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 0, 0 }, 1, new int [] { 0, 1 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 0, 0, 0 }, 1, new int [] { 0, 0, 1 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1 }, 1, new int [] { 0 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1 }, 2, new int [] { 0 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1 }, 3, new int [] { 0 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1, 1 }, 2, new int [] { 0, 1 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1, 1 }, 3, new int [] { 0, 2 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1, 1 }, 4, new int [] { 0, 3 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1, 1, 1 }, 3, new int [] { 0, 1, 2 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3 }, 6, new int [] { 0, 1, 3 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3 }, 7, new int [] { 0, 1, 4 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3 }, 8, new int [] { 0, 1, 5 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3 }, 9, new int [] { 0, 1, 6 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3 }, 10, new int [] { 0, 1, 7 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3 }, 11, new int [] { 0, 1, 8 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3, 4 }, 10, new int [] { 0, 1, 3, 6 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3, 4 }, 11, new int [] { 0, 1, 3, 7 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 1, 2, 3, 4 }, 12, new int [] { 0, 1, 3, 8 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 3, 3, 3 }, 21, new int [] { 0, 3, 18 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 3, 4, 5 }, 21, new int [] { 0, 3, 16 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 33, 33, 33 }, 100, new int [] { 0, 33, 67 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 10 }, 101, new int [] { 0 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 10, 20 }, 101, new int [] { 0, 81 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 10, 20, 30 }, 100, new int [] { 0, 10, 70 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 10, 20, 30 }, 101, new int [] { 0, 10, 71 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 10, 20, 30, 40 }, 101, new int [] { 0, 10, 30, 61 })]
-    //[InlineData (Justification.OneRightRestLeft, new int [] { 10, 20, 30, 40, 50 }, 151, new int [] { 0, 10, 30, 60, 101, })]
-
-
-    [InlineData (Justification.OneLeftRestRight, new int [] { 0 }, 1, new int [] { 0 })]
-    [InlineData (Justification.OneLeftRestRight, new int [] { 0, 0 }, 1, new int [] { 0, 1 })]
-    [InlineData (Justification.OneLeftRestRight, new int [] { 0, 0, 0 }, 1, new int [] { 0, 1, 1 })]
-    [InlineData (Justification.OneLeftRestRight, new int [] { 1 }, 1, new int [] { 0 })]
-    [InlineData (Justification.OneLeftRestRight, new int [] { 1 }, 2, new int [] { 1 })]
-    [InlineData (Justification.OneLeftRestRight, new int [] { 1 }, 3, new int [] { 2 })]
-    [InlineData (Justification.OneLeftRestRight, new int [] { 1, 1 }, 2, new int [] { 0, 1 })]
-    [InlineData (Justification.OneLeftRestRight, new int [] { 1, 1 }, 3, new int [] { 0, 2 })]
-    [InlineData (Justification.OneLeftRestRight, new int [] { 1, 1 }, 4, new int [] { 0, 3 })]
-    [InlineData (Justification.OneLeftRestRight, new int [] { 1, 1, 1 }, 3, new int [] { 0, 1, 2 })]
-    [InlineData (Justification.OneLeftRestRight, new int [] { 1, 2, 3 }, 6, new int [] { 0, 1, 3 })]
-    [InlineData (Justification.OneLeftRestRight, new int [] { 1, 2, 3 }, 7, new int [] { 0, 2, 4 })]
-    [InlineData (Justification.OneLeftRestRight, new int [] { 1, 2, 3 }, 8, new int [] { 0, 3, 5 })]
-    [InlineData (Justification.OneLeftRestRight, new int [] { 1, 2, 3 }, 9, new int [] { 0, 4, 6 })]
-    //[InlineData (Justification.OneLeftRestRight, new int [] { 1, 2, 3 }, 10, new int [] { 0, 1, 7 })]
-    //[InlineData (Justification.OneLeftRestRight, new int [] { 1, 2, 3 }, 11, new int [] { 0, 1, 8 })]
-    //[InlineData (Justification.OneLeftRestRight, new int [] { 1, 2, 3, 4 }, 10, new int [] { 0, 1, 3, 6 })]
-    //[InlineData (Justification.OneLeftRestRight, new int [] { 1, 2, 3, 4 }, 11, new int [] { 0, 1, 3, 7 })]
-    //[InlineData (Justification.OneLeftRestRight, new int [] { 1, 2, 3, 4 }, 12, new int [] { 0, 1, 3, 8 })]
-    //[InlineData (Justification.OneLeftRestRight, new int [] { 3, 3, 3 }, 21, new int [] { 0, 3, 18 })]
-    //[InlineData (Justification.OneLeftRestRight, new int [] { 3, 4, 5 }, 21, new int [] { 0, 3, 16 })]
-    //[InlineData (Justification.OneLeftRestRight, new int [] { 33, 33, 33 }, 100, new int [] { 0, 33, 67 })]
-    //[InlineData (Justification.OneLeftRestRight, new int [] { 10 }, 101, new int [] { 0 })]
-    //[InlineData (Justification.OneLeftRestRight, new int [] { 10, 20 }, 101, new int [] { 0, 81 })]
-    //[InlineData (Justification.OneLeftRestRight, new int [] { 10, 20, 30 }, 100, new int [] { 0, 10, 70 })]
-    //[InlineData (Justification.OneLeftRestRight, new int [] { 10, 20, 30 }, 101, new int [] { 0, 10, 71 })]
-    //[InlineData (Justification.OneLeftRestRight, new int [] { 10, 20, 30, 40 }, 101, new int [] { 0, 10, 30, 61 })]
-    //[InlineData (Justification.OneLeftRestRight, new int [] { 10, 20, 30, 40, 50 }, 151, new int [] { 0, 10, 30, 60, 101, })]
-
-
-
-    public void TestJustifications_0Space (Justification justification, int [] sizes, int totalSize, int [] expected)
+    [InlineData (Justification.Left, new [] { 0 }, 1, new [] { 0 })]
+    [InlineData (Justification.Left, new [] { 0, 0 }, 1, new [] { 0, 0 })]
+    [InlineData (Justification.Left, new [] { 0, 0, 0 }, 1, new [] { 0, 0, 0 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 7, new [] { 0, 1, 3 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 10, new [] { 0, 1, 3 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 11, new [] { 0, 1, 3 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 12, new [] { 0, 1, 3 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3 }, 13, new [] { 0, 1, 3 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Justification.Left, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 1, 3, 6 })]
+    [InlineData (Justification.Left, new [] { 10, 20, 30 }, 100, new [] { 0, 10, 30 })]
+    [InlineData (Justification.Left, new [] { 33, 33, 33 }, 100, new [] { 0, 33, 66 })]
+    [InlineData (Justification.Left, new [] { 10 }, 101, new [] { 0 })]
+    [InlineData (Justification.Left, new [] { 10, 20 }, 101, new [] { 0, 10 })]
+    [InlineData (Justification.Left, new [] { 10, 20, 30 }, 101, new [] { 0, 10, 30 })]
+    [InlineData (Justification.Left, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 10, 30, 60 })]
+    [InlineData (Justification.Left, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 10, 30, 60, 100 })]
+    [InlineData (Justification.Right, new [] { 0 }, 1, new [] { 1 })]
+    [InlineData (Justification.Right, new [] { 0, 0 }, 1, new [] { 1, 1 })]
+    [InlineData (Justification.Right, new [] { 0, 0, 0 }, 1, new [] { 1, 1, 1 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 7, new [] { 1, 2, 4 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 10, new [] { 4, 5, 7 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 11, new [] { 5, 6, 8 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 12, new [] { 6, 7, 9 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3 }, 13, new [] { 7, 8, 10 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Justification.Right, new [] { 1, 2, 3, 4 }, 11, new [] { 1, 2, 4, 7 })]
+    [InlineData (Justification.Right, new [] { 10, 20, 30 }, 100, new [] { 40, 50, 70 })]
+    [InlineData (Justification.Right, new [] { 33, 33, 33 }, 100, new [] { 1, 34, 67 })]
+    [InlineData (Justification.Right, new [] { 10 }, 101, new [] { 91 })]
+    [InlineData (Justification.Right, new [] { 10, 20 }, 101, new [] { 71, 81 })]
+    [InlineData (Justification.Right, new [] { 10, 20, 30 }, 101, new [] { 41, 51, 71 })]
+    [InlineData (Justification.Right, new [] { 10, 20, 30, 40 }, 101, new [] { 1, 11, 31, 61 })]
+    [InlineData (Justification.Right, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 1, 11, 31, 61, 101 })]
+    [InlineData (Justification.Centered, new [] { 1 }, 1, new [] { 0 })]
+    [InlineData (Justification.Centered, new [] { 1 }, 2, new [] { 0 })]
+    [InlineData (Justification.Centered, new [] { 1 }, 3, new [] { 1 })]
+    [InlineData (Justification.Centered, new [] { 1, 1 }, 2, new [] { 0, 1 })]
+    [InlineData (Justification.Centered, new [] { 1, 1 }, 3, new [] { 0, 1 })]
+    [InlineData (Justification.Centered, new [] { 1, 1 }, 4, new [] { 1, 2 })]
+    [InlineData (Justification.Centered, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
+    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 7, new [] { 0, 1, 3 })]
+    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 10, new [] { 2, 3, 5 })]
+    [InlineData (Justification.Centered, new [] { 1, 2, 3 }, 11, new [] { 2, 3, 5 })]
+    [InlineData (Justification.Centered, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Justification.Centered, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 1, 3, 6 })]
+    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 9, new [] { 0, 3, 6 })]
+    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 10, new [] { 0, 3, 6 })]
+    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 11, new [] { 1, 4, 7 })]
+    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 12, new [] { 1, 4, 7 })]
+    [InlineData (Justification.Centered, new [] { 3, 3, 3 }, 13, new [] { 2, 5, 8 })]
+    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 100, new [] { 0, 33, 66 })]
+    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 101, new [] { 1, 34, 67 })]
+    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 102, new [] { 1, 34, 67 })]
+    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 103, new [] { 2, 35, 68 })]
+    [InlineData (Justification.Centered, new [] { 33, 33, 33 }, 104, new [] { 2, 35, 68 })]
+    [InlineData (Justification.Centered, new [] { 3, 4, 5, 6 }, 25, new [] { 3, 6, 10, 15 })]
+    [InlineData (Justification.Justified, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
+    [InlineData (Justification.Justified, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
+    [InlineData (Justification.Justified, new [] { 10, 20, 30 }, 100, new [] { 0, 30, 70 })]
+    [InlineData (Justification.Justified, new [] { 10, 20, 30 }, 101, new [] { 0, 31, 71 })]
+    [InlineData (Justification.Justified, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
+    [InlineData (Justification.Justified, new [] { 11, 17, 23 }, 100, new [] { 0, 36, 77 })]
+    [InlineData (Justification.Justified, new [] { 1, 2, 3 }, 11, new [] { 0, 4, 8 })]
+    [InlineData (Justification.Justified, new [] { 10, 20 }, 101, new [] { 0, 81 })]
+    [InlineData (Justification.Justified, new [] { 10 }, 101, new [] { 0 })]
+    [InlineData (Justification.Justified, new [] { 3, 3, 3 }, 21, new [] { 0, 9, 18 })]
+    [InlineData (Justification.Justified, new [] { 3, 4, 5 }, 21, new [] { 0, 8, 16 })]
+    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 18, new [] { 0, 3, 7, 12 })]
+    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 19, new [] { 0, 4, 8, 13 })]
+    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 20, new [] { 0, 4, 9, 14 })]
+    [InlineData (Justification.Justified, new [] { 3, 4, 5, 6 }, 21, new [] { 0, 4, 9, 15 })]
+    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 22, new [] { 0, 8, 14, 19 })]
+    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 23, new [] { 0, 8, 15, 20 })]
+    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 24, new [] { 0, 8, 15, 21 })]
+    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 25, new [] { 0, 9, 16, 22 })]
+    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 26, new [] { 0, 9, 17, 23 })]
+    [InlineData (Justification.Justified, new [] { 6, 5, 4, 3 }, 31, new [] { 0, 11, 20, 28 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 0 }, 1, new [] { 1 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 0, 0 }, 1, new [] { 0, 1 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 0, 0, 0 }, 1, new [] { 0, 0, 1 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1 }, 1, new [] { 0 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1 }, 2, new [] { 1 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1 }, 3, new [] { 2 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1 }, 2, new [] { 0, 1 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1 }, 3, new [] { 0, 2 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1 }, 4, new [] { 0, 3 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 7, new [] { 0, 1, 4 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 8, new [] { 0, 1, 5 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 9, new [] { 0, 1, 6 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 10, new [] { 0, 1, 7 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3 }, 11, new [] { 0, 1, 8 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 1, 3, 7 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 1, 2, 3, 4 }, 12, new [] { 0, 1, 3, 8 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 3, 3, 3 }, 21, new [] { 0, 3, 18 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 3, 4, 5 }, 21, new [] { 0, 3, 16 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 33, 33, 33 }, 100, new [] { 0, 33, 67 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 10 }, 101, new [] { 91 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20 }, 101, new [] { 0, 81 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30 }, 100, new [] { 0, 10, 70 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30 }, 101, new [] { 0, 10, 71 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 10, 30, 61 })]
+    [InlineData (Justification.LastRightRestLeft, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 10, 30, 60, 101 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 0 }, 1, new [] { 0 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 0, 0 }, 1, new [] { 0, 1 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 0, 0, 0 }, 1, new [] { 0, 1, 1 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1 }, 1, new [] { 0 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1 }, 2, new [] { 0 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1 }, 3, new [] { 0 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1 }, 2, new [] { 0, 1 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1 }, 3, new [] { 0, 2 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1 }, 4, new [] { 0, 3 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 1, 1 }, 3, new [] { 0, 1, 2 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 6, new [] { 0, 1, 3 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 7, new [] { 0, 2, 4 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 8, new [] { 0, 3, 5 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 9, new [] { 0, 4, 6 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 10, new [] { 0, 5, 7 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3 }, 11, new [] { 0, 6, 8 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 10, new [] { 0, 1, 3, 6 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 11, new [] { 0, 2, 4, 7 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 1, 2, 3, 4 }, 12, new [] { 0, 3, 5, 8 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 3, 3, 3 }, 21, new [] { 0, 15, 18 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 3, 4, 5 }, 21, new [] { 0, 12, 16 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 33, 33, 33 }, 100, new [] { 0, 34, 67 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 10 }, 101, new [] { 0 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20 }, 101, new [] { 0, 81 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30 }, 100, new [] { 0, 50, 70 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30 }, 101, new [] { 0, 51, 71 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 11, 31, 61 })]
+    [InlineData (Justification.FirstLeftRestRight, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 11, 31, 61, 101 })]
+    public void TestJustifications_NoSpaceBetweenItems (Justification justification, int [] sizes, int totalSize, int [] expected)
     {
-        var positions = new Justifier () { MaxSpaceBetweenItems = 0 }.Justify (sizes, justification, totalSize);
+        int [] positions = new Justifier { PutSpaceBetweenItems = false }.Justify (sizes, justification, totalSize);
         AssertJustification (justification, sizes, totalSize, positions, expected);
     }
 
@@ -364,33 +367,37 @@ public class JustifierTests (ITestOutputHelper output)
         }
     }
 
-
     public string RenderJustification (Justification justification, int [] sizes, int totalSize, int [] positions)
     {
         var output = new StringBuilder ();
         output.AppendLine ($"Justification: {justification}, Positions: {string.Join (", ", positions)}, TotalSize: {totalSize}");
-        for (int i = 0; i <= totalSize / 10; i++)
+
+        for (var i = 0; i <= totalSize / 10; i++)
         {
             output.Append (i.ToString ().PadRight (9) + " ");
         }
+
         output.AppendLine ();
 
-        for (int i = 0; i < totalSize; i++)
+        for (var i = 0; i < totalSize; i++)
         {
             output.Append (i % 10);
         }
+
         output.AppendLine ();
 
         var items = new char [totalSize];
-        for (int position = 0; position < positions.Length; position++)
+
+        for (var position = 0; position < positions.Length; position++)
         {
             // try
             {
-                for (int j = 0; j < sizes [position] && positions [position] + j < totalSize; j++)
+                for (var j = 0; j < sizes [position] && positions [position] + j < totalSize; j++)
                 {
                     items [positions [position] + j] = (position + 1).ToString () [0];
                 }
             }
+
             //catch (Exception e)
             //{
             //    output.AppendLine ($"{e.Message} - position = {position}, positions[{position}]: {positions [position]}, sizes[{position}]: {sizes [position]}, totalSize: {totalSize}");
@@ -404,5 +411,4 @@ public class JustifierTests (ITestOutputHelper output)
 
         return output.ToString ();
     }
-
 }