From 692054182ac3f85df83455a17616dbafed18ebda Mon Sep 17 00:00:00 2001 From: Fernando Brito Date: Thu, 2 Dec 2010 15:42:44 -0300 Subject: [PATCH] Add text/x-prolog --- freedesktop.org.xml.in | 7 +++++++ tests/list | 3 +++ tests/test.pl | 20 ++++++++++++++++++++ tests/test.pro | 20 ++++++++++++++++++++ tests/test.prolog | 20 ++++++++++++++++++++ 5 files changed, 70 insertions(+), 0 deletions(-) create mode 100644 tests/test.pl create mode 100644 tests/test.pro create mode 100644 tests/test.prolog diff --git a/freedesktop.org.xml.in b/freedesktop.org.xml.in index cd72ed4..14631e9 100644 --- a/freedesktop.org.xml.in +++ b/freedesktop.org.xml.in @@ -2286,6 +2286,13 @@ command to generate the output files. + + <_comment>Prolog source file + + + + + <_comment>Adobe FrameMaker MIF document diff --git a/tests/list b/tests/list index b7f9447..8e39ece 100644 --- a/tests/list +++ b/tests/list @@ -234,6 +234,9 @@ test.mml application/mathml+xml ox linguist.ts text/vnd.trolltech.linguist test.xsl application/xslt+xml test.cbl text/x-cobol ox +test.pl text/x-prolog +test.pro text/x-prolog +test.prolog text/x-prolog # Archives # Copied from http://bugs.freedesktop.org/show_bug.cgi?id=14909 diff --git a/tests/test.pl b/tests/test.pl new file mode 100644 index 0000000..21c82df --- /dev/null +++ b/tests/test.pl @@ -0,0 +1,20 @@ +% test.pl -- quicksort implementation + +/* [+,-] */ +quicksort([], []). +quicksort([HEAD | TAIL], SORTED) :- partition(HEAD, TAIL, LEFT, RIGHT), + quicksort(LEFT, SORTEDL), + quicksort(RIGHT, SORTEDR), + append(SORTEDL, [HEAD | SORTEDR], SORTED). + +/* [+,+,-,-] */ +partition(PIVOT, [], [], []). +partition(PIVOT, [HEAD | TAIL], [HEAD | LEFT], RIGHT) :- HEAD @=< PIVOT, + partition(PIVOT, TAIL, LEFT, RIGHT). +partition(PIVOT, [HEAD | TAIL], LEFT, [HEAD | RIGHT]) :- HEAD @> PIVOT, + partition(PIVOT, TAIL, LEFT, RIGHT). + +/* [+,+,-] */ +append([], LIST, LIST). +append([HEAD | LIST1], LIST2, [HEAD | LIST3]) :- append(LIST1, LIST2, LIST3). + diff --git a/tests/test.pro b/tests/test.pro new file mode 100644 index 0000000..ebe365c --- /dev/null +++ b/tests/test.pro @@ -0,0 +1,20 @@ +% test.pro -- quicksort implementation + +/* [+,-] */ +quicksort([], []). +quicksort([HEAD | TAIL], SORTED) :- partition(HEAD, TAIL, LEFT, RIGHT), + quicksort(LEFT, SORTEDL), + quicksort(RIGHT, SORTEDR), + append(SORTEDL, [HEAD | SORTEDR], SORTED). + +/* [+,+,-,-] */ +partition(PIVOT, [], [], []). +partition(PIVOT, [HEAD | TAIL], [HEAD | LEFT], RIGHT) :- HEAD @=< PIVOT, + partition(PIVOT, TAIL, LEFT, RIGHT). +partition(PIVOT, [HEAD | TAIL], LEFT, [HEAD | RIGHT]) :- HEAD @> PIVOT, + partition(PIVOT, TAIL, LEFT, RIGHT). + +/* [+,+,-] */ +append([], LIST, LIST). +append([HEAD | LIST1], LIST2, [HEAD | LIST3]) :- append(LIST1, LIST2, LIST3). + diff --git a/tests/test.prolog b/tests/test.prolog new file mode 100644 index 0000000..6a141d4 --- /dev/null +++ b/tests/test.prolog @@ -0,0 +1,20 @@ +% test.prolog -- quicksort implementation + +/* [+,-] */ +quicksort([], []). +quicksort([HEAD | TAIL], SORTED) :- partition(HEAD, TAIL, LEFT, RIGHT), + quicksort(LEFT, SORTEDL), + quicksort(RIGHT, SORTEDR), + append(SORTEDL, [HEAD | SORTEDR], SORTED). + +/* [+,+,-,-] */ +partition(PIVOT, [], [], []). +partition(PIVOT, [HEAD | TAIL], [HEAD | LEFT], RIGHT) :- HEAD @=< PIVOT, + partition(PIVOT, TAIL, LEFT, RIGHT). +partition(PIVOT, [HEAD | TAIL], LEFT, [HEAD | RIGHT]) :- HEAD @> PIVOT, + partition(PIVOT, TAIL, LEFT, RIGHT). + +/* [+,+,-] */ +append([], LIST, LIST). +append([HEAD | LIST1], LIST2, [HEAD | LIST3]) :- append(LIST1, LIST2, LIST3). + -- 1.7.1