Skip to content

Commit

Permalink
Add some tests for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
beutlich committed Oct 29, 2020
1 parent 681b3b5 commit 4fef18c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions .CI/Test/ModelicaStrings.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ int main(int argc, char **argv) {
assert(0 == strcmp("bc", ModelicaStrings_substring("abc",2,3)));
assert(0 == strcmp("bc", ModelicaStrings_substring("abc",2,4)));
assert(0 == strcmp("", ModelicaStrings_substring("abc",4,4)));
return 0;
}
29 changes: 29 additions & 0 deletions .CI/Test/ModelicaTime.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "../../Modelica/Resources/C-Sources/ModelicaTime.h"
#include "Common.c"

#include <assert.h>
#include <string.h>

int main(int argc, char **argv) {
int ms = 501;
int sec = 30;
int min = 44;
int hour = 20;
int mday = 29;
int mon = 10;
int year = 2020;
const char *format = "%Y-%m-%d %H:%M:%S.L";
int maxSize = 128;
const char *dateStr = ModelicaTime_strftime(ms, sec, min, hour, mday, mon, year, format, maxSize);
ModelicaFormatMessage("Date: %s\n", dateStr),
// assert(0 == strcmp("2020-10-29 20:44:30.501", dateStr));
ModelicaTime_strptime(&ms, &sec, &min, &hour, &mday, &mon, &year, "2000-09-30 06:45:01.123", format);
assert(ms == 123);
assert(sec == 1);
assert(min == 45);
assert(hour == 6);
assert(mday == 30);
assert(mon == 9);
assert(year == 2000);
return 0;
}
4 changes: 4 additions & 0 deletions .CI/Test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ if test ! "$1" = "nostatic"; then
./a.out || exit 1
"$CC" -L $LIBRARIES ModelicaStrings.c -Wl,-Bstatic -lModelicaExternalC -Wl,-Bdynamic || exit 1
./a.out || exit 1
"$CC" -L $LIBRARIES ModelicaTime.c -Wl,-Bstatic -lModelicaExternalC -Wl,-Bdynamic || exit 1
./a.out || exit 1
"$CC" -L $LIBRARIES Tables.c -Wl,-Bstatic -lModelicaStandardTables -lModelicaIO -lModelicaMatIO -lzlib -Wl,-Bdynamic -lm || exit 1
./a.out || exit 1
"$CC" -L $LIBRARIES TablesFromTxtFile.c -Wl,-Bstatic -lModelicaStandardTables -lModelicaIO -lModelicaMatIO -lzlib -Wl,-Bdynamic -lm || exit 1
Expand All @@ -27,6 +29,8 @@ if test ! "$1" = "onlystatic"; then
./a.out || exit 1
"$CC" -L $LIBRARIES -Wl,-rpath $LIBRARIES ModelicaStrings.c -lModelicaExternalC || exit 1
./a.out || exit 1
"$CC" -L $LIBRARIES -Wl,-rpath $LIBRARIES ModelicaTime.c -lModelicaExternalC || exit 1
./a.out || exit 1
"$CC" -L $LIBRARIES -Wl,-rpath $LIBRARIES Tables.c -lModelicaStandardTables -lModelicaIO -lModelicaMatIO || exit 1
./a.out || exit 1
"$CC" -L $LIBRARIES -Wl,-rpath $LIBRARIES TablesFromMatFile.c -lModelicaStandardTables -lModelicaIO -lModelicaMatIO || exit 1
Expand Down

0 comments on commit 4fef18c

Please sign in to comment.