From 5d242db04dcd59689c989d6b089d8ad15ed17fea Mon Sep 17 00:00:00 2001
From: Arnas Udovicius <zordsdavini@gmail.com>
Date: Tue, 8 Jun 2021 19:23:06 +0300
Subject: [PATCH] working with test

---
 .gitignore |  2 ++
 plural.c   | 45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)
 create mode 100644 plural.c

diff --git a/.gitignore b/.gitignore
index cd531cf..729ccd5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,3 +52,5 @@ Module.symvers
 Mkfile.old
 dkms.conf
 
+tags
+plural
diff --git a/plural.c b/plural.c
new file mode 100644
index 0000000..68ddeee
--- /dev/null
+++ b/plural.c
@@ -0,0 +1,45 @@
+/**
+ * Samogitian language (ISO-639-3: sgs) plural forms
+ * Written by Arns Udovič in 2021 <a@arns.lt>
+ *
+ * Refs:
+ * https://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ *
+ * 0 - singular or ending in 1 with exception for 11. Ex., 1 laps
+ * 1 - dual or ending in 2 with exception for 12. Ex. 2 lapo
+ * 2 - other plural. Ex. 25 lapā
+ * 3 - plural for 11-19, 10, 20, 100... Ex. 12 lapu
+ */
+
+#include <stdio.h>
+
+main() {
+    int i;
+    int n;
+    int plural;
+
+    printf("This is test of plural forms for Samogitian languages\n");
+    printf("Written by Arns Udovič in 2021 <a@arns.lt>\n\n");
+    printf("0 - singular or ending in 1 with exception for 11. Ex., 1 laps\n");
+    printf("1 - dual or ending in 2 with exception for 12. Ex. 2 lapo\n");
+    printf("2 - other plural. Ex. 25 lapā\n");
+    printf("3 - plural for 11-19, 10, 20, 100... Ex. 12 lapu\n\n");
+
+    int data[] = {0, 1, 2, 3, 10, 11, 15, 20, 21, 22, 25, 100, 101, 102, 115, 200, 1000, 100000};
+    int result[] = {3, 0, 1, 2, 3, 3, 3, 3, 0, 1, 2, 3, 0, 1, 3, 3, 3, 3};
+
+    for (i = 0; i < sizeof(data)/sizeof(int); ++i) {
+        n = data[i];
+
+        plural=(n % 10 == 1 && n % 100 != 11) ? 0
+            : ((n % 10 == 2 && n % 100 != 12) ? 1
+            : ((n % 10 >= 3 && n % 10 <= 9 && (n % 100 < 11 || n % 100 > 19)) ? 2
+            : 3));
+
+
+        printf("Testing %i, should be: %i, got %i\n", n, result[i], plural);
+
+    }
+
+    return 0;
+}