diff --git a/README.md b/README.md
index 4eab1a4..8b8a2dd 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,11 @@
-dotsPlacementIssue
+2D Point Triangulation
============================
-Algorithm solves the problem of the points placement according to the length which is specified in the matrix.
+This project is dedicated to positioning (triangulating) points in a two-dimensional
+Cartesian system, where the origin is always fixed at `(0, 0)`. The algorithms
+reconstruct coordinates using a matrix of pairwise Manhattan distances between
+points.
-Implantation details
+Implementation details
============================
The main idea of this algorithm is to try every possible combination of calculated coordinates until the correct answer(s) is found.
This is a recursive algorithm with backtracking approach.
@@ -65,7 +68,7 @@ According to the matrix we can say the distance between two dots.
Thus, the
- From point [0] to point [0] = 0 (distance to itself is zero -> obvious)
- From point [0] to point [1] = 2
- - Frm point [0] to point [2] = 2
+
- From point [0] to point [2] = 2
...
- 0->9 = 8
- 1->0 = 2
@@ -80,3 +83,22 @@ If we visualise the result using Cartesian coordinate system we will get the pic

_Note_: Blue color was used to indicate rules of calculating the distance.
__Pay attention__: The distance is not weight of the line which _directly_ connects two dots (lines may be angular).
+
+Running tests
+============================
+The Python implementation includes a small unit test suite. Execute the following command from the project root:
+
+```
+PYTHONPATH=python_impl python3 -m unittest
+```
+
+The Java implementation uses JUnit 5. Compile the sources and run the tests using the console launcher:
+
+```
+javac -d java_impl/build/classes \
+ $(find java_impl/src -path '*visual*' -prune -o -name '*.java' -print)
+javac -d java_impl/build/test-classes -cp java_impl/build/classes:/usr/share/java/junit-platform-console-standalone.jar \
+ $(find java_impl/tests -name '*.java')
+java -jar /usr/share/java/junit-platform-console-standalone.jar \
+ -cp java_impl/build/classes:java_impl/build/test-classes --scan-class-path
+```
diff --git a/java_impl/tests/SimplePointsFinderTest.java b/java_impl/tests/SimplePointsFinderTest.java
new file mode 100644
index 0000000..510476b
--- /dev/null
+++ b/java_impl/tests/SimplePointsFinderTest.java
@@ -0,0 +1,36 @@
+package com.gitlab.saylenty;
+
+import com.gitlab.saylenty.entity.Point;
+import com.gitlab.saylenty.strategy.PointsFinderStrategy;
+import com.gitlab.saylenty.strategy.SimplePointsFinder;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+public class SimplePointsFinderTest {
+ @Test
+ public void testSimpleTriangulation() {
+ int[][] matrix = {
+ {0, 1, 2},
+ {1, 0, 3},
+ {2, 3, 0}
+ };
+ PointsFinderStrategy solver = new SimplePointsFinder();
+ List solutions = solver.findSolution(matrix);
+ assertFalse(solutions.isEmpty(), "Expected at least one solution");
+ Point[] coords = solutions.get(0);
+ assertEquals(new Point(0, 0), coords[0]);
+ int n = matrix.length;
+ assertEquals(n, coords.length);
+ for (int i = 0; i < n; i++) {
+ for (int j = 0; j < n; j++) {
+ int dist = PointsFinderStrategy.absDistance(
+ coords[i].getX(), coords[i].getY(),
+ coords[j].getX(), coords[j].getY());
+ assertEquals(matrix[i][j], dist);
+ }
+ }
+ }
+}
diff --git a/java_impl/tests/com/sun/istack/internal/NotNull.java b/java_impl/tests/com/sun/istack/internal/NotNull.java
new file mode 100644
index 0000000..95dc07b
--- /dev/null
+++ b/java_impl/tests/com/sun/istack/internal/NotNull.java
@@ -0,0 +1,5 @@
+package com.sun.istack.internal;
+import java.lang.annotation.*;
+@Retention(RetentionPolicy.CLASS)
+@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD, ElementType.TYPE})
+public @interface NotNull {}
diff --git a/python_impl/tests/test_algorythm.py b/python_impl/tests/test_algorythm.py
new file mode 100644
index 0000000..eaee0de
--- /dev/null
+++ b/python_impl/tests/test_algorythm.py
@@ -0,0 +1,23 @@
+import unittest
+import algorythm
+
+class TestAlgorythm(unittest.TestCase):
+ def test_triangulation(self):
+ matrix = (
+ (0, 1, 2),
+ (1, 0, 3),
+ (2, 3, 0),
+ )
+ algorythm.matrix = matrix
+ coords = algorythm.wr()
+ self.assertEqual(coords[0], (0, 0))
+ n = len(matrix)
+ self.assertEqual(len(coords), n)
+ for i in range(n):
+ for j in range(n):
+ expected = matrix[i][j]
+ dist = abs(coords[i][0] - coords[j][0]) + abs(coords[i][1] - coords[j][1])
+ self.assertEqual(dist, expected)
+
+if __name__ == '__main__':
+ unittest.main()