From 4c7bb91e7008eecf01dfc1a6eb1378bab5337509 Mon Sep 17 00:00:00 2001 From: Vlasta Vesely Date: Fri, 19 Feb 2021 13:27:40 +0100 Subject: [PATCH] add the first sukta of Rg Veda to the tests --- iast.c | 2 +- main.c | 2 +- tests/integration.sh | 8 +++++++- tests/texts/rg-01001.txt | 26 ++++++++++++++++++++++++++ transliteration.c | 2 ++ 5 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 tests/texts/rg-01001.txt diff --git a/iast.c b/iast.c index 1df5572..91ead57 100644 --- a/iast.c +++ b/iast.c @@ -42,7 +42,7 @@ static struct translit_letter table[] = { {0x0939, CONSONANT, "h"}, /* 14 */ {0x091a, CONSONANT, "c"}, /* 15 */ {0x091c, CONSONANT, "j"}, /* 16 */ - {0x091e, CONSONANT, "\u00f1"}, /* 17 (n~) */ + {0x091e, CONSONANT, "\u00f1"}, /* 17 (~n) */ {0x092f, CONSONANT, "y"}, /* 18 */ {0x0936, CONSONANT, "\u015b"}, /* 19 ("s) */ {0x091f, CONSONANT, "\u1e6d"}, /* 20 (.t) */ diff --git a/main.c b/main.c index b180909..b6da0a9 100644 --- a/main.c +++ b/main.c @@ -4,7 +4,7 @@ #include "velthuis.h" #define PROGNAME "iast" -#define VERSION "1.0" +#define VERSION "2.0" #define FLAG_REVERSE 1 << 0 #define FLAG_ENCODE 1 << 1 diff --git a/tests/integration.sh b/tests/integration.sh index 45f309c..8b4a25e 100644 --- a/tests/integration.sh +++ b/tests/integration.sh @@ -5,12 +5,14 @@ usage=$(./iast -h) test -n $(echo "$usage" | grep "iast [flags and text arguments in any order]") version=$(./iast -v) -test "$version" = "iast v1.0" +test "$version" = "iast v2.0" ./iast -f tests/texts/bhagavadgita-1.txt | ./iast -r -f - >/tmp/iast-bhagavadgita-1.txt.out ./iast -f tests/texts/mandukya-upanishad.txt | ./iast -r -f - >/tmp/iast-mandukya-upanishad.txt.out +./iast -f tests/texts/rg-01001.txt | + ./iast -r -f - >/tmp/rg-01001.txt.out expected=$(sha1sum tests/texts/bhagavadgita-1.txt | head -c40) computed=$(sha1sum /tmp/iast-bhagavadgita-1.txt.out | head -c40) @@ -20,4 +22,8 @@ expected=$(sha1sum tests/texts/mandukya-upanishad.txt | head -c40) computed=$(sha1sum /tmp/iast-mandukya-upanishad.txt.out | head -c40) test "$expected" = "$computed" +expected=$(sha1sum tests/texts/rg-01001.txt | head -c40) +computed=$(sha1sum /tmp/rg-01001.txt.out | head -c40) +test "$expected" = "$computed" + printf "\033[32mpassed\033[0m\n" diff --git a/tests/texts/rg-01001.txt b/tests/texts/rg-01001.txt new file mode 100644 index 0000000..331a9ec --- /dev/null +++ b/tests/texts/rg-01001.txt @@ -0,0 +1,26 @@ +ॐ अग्निमी॑ळे पुरोहि॑तं यज्ञस्य॓ देवमृत्विज॑म् । +होता॑रं रत्नधात॑मम् ॥१॥ + +अग्निः पूर्वेभिरृषिभिरीड्यो नूतनैरुत । +स देवाँ एह वक्षति ॥२॥ + +अग्निना रयिमश्नवत् पोषमेव दिवेदिवे । +यशसं वीरवत्तमम् ॥३॥ + +अग्ने यं यज्ञमध्वरं विश्वतः परिभूरसि । +स इद्देवेषु गच्छति ॥४॥ + +अग्निर्होता कविक्रतुः सत्यश्चित्रश्रवस्तमः । +देवो देवेभिरा गमत् ॥५॥ + +यदङ्ग दाशुषे त्वमग्ने भद्रं करिष्यसि । +तवेत् तत् सत्यमङ्गिरः ॥६॥ + +उप त्वाग्ने दिवेदिवे दोषावस्तर्धिया वयम् । +नमो भरन्त एमसि ॥७॥ + +राजन्तमध्वराणां गोपामृतस्य दीदिविम् । +वर्धमानं स्वे दमे ॥८॥ + +स नः पितेव सूनवेऽग्ने सूपायनो भव । +सचस्वा नः स्वस्तये ॥९॥ diff --git a/transliteration.c b/transliteration.c index dfebd22..d5a0e35 100644 --- a/transliteration.c +++ b/transliteration.c @@ -113,6 +113,7 @@ char *transliterate_latin_to_devanagari(const char *latin) alloc += CHUNKSIZE; } + /* consonant (.l) */ if (strncmp(src, "\u1e37", 3) == 0) { letter = letter_by_data(table, src + 3); if (letter && letter->type == VOWEL) { @@ -123,6 +124,7 @@ char *transliterate_latin_to_devanagari(const char *latin) } } + /* candrabindu */ if (strncmp(src, "m\u0310", 3) == 0) { utf8_pack_char(devanagari + done, 0x0901); done += 3;