mathematical 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/Rakefile +4 -0
- data/ext/mathematical/extconf.rb +9 -15
- data/ext/mathematical/mtex2MML/build/mtex2MML.h +73 -0
- data/ext/mathematical/mtex2MML/{src/deps → deps}/uthash/utarray.h +0 -0
- data/ext/mathematical/mtex2MML/{src/deps → deps}/uthash/uthash.h +0 -0
- data/ext/mathematical/mtex2MML/{src/deps → deps}/uthash/utlist.h +0 -0
- data/ext/mathematical/mtex2MML/{src/deps → deps}/uthash/utstring.h +0 -0
- data/ext/mathematical/mtex2MML/src/color_definitions.c +1 -1
- data/ext/mathematical/mtex2MML/src/lex.yy.c +1100 -1098
- data/ext/mathematical/mtex2MML/src/main.c +137 -0
- data/ext/mathematical/mtex2MML/src/mtex2MML.h +11 -1
- data/ext/mathematical/mtex2MML/src/parse_extras.c +2 -2
- data/ext/mathematical/mtex2MML/src/parse_extras.h +36 -36
- data/ext/mathematical/mtex2MML/src/string_extras.c +0 -6
- data/ext/mathematical/mtex2MML/src/string_extras.h +1 -1
- data/ext/mathematical/mtex2MML/src/y.tab.c +3904 -3583
- data/ext/mathematical/mtex2MML/tests/array.c +127 -0
- data/ext/mathematical/mtex2MML/tests/basic.c +85 -0
- data/ext/mathematical/mtex2MML/tests/clar.c +642 -0
- data/ext/mathematical/mtex2MML/tests/clar.h +163 -0
- data/ext/mathematical/mtex2MML/tests/clar/fixtures.h +38 -0
- data/ext/mathematical/mtex2MML/tests/clar/fs.h +333 -0
- data/ext/mathematical/mtex2MML/tests/clar/print.h +66 -0
- data/ext/mathematical/mtex2MML/tests/clar/sandbox.h +139 -0
- data/ext/mathematical/mtex2MML/tests/clar_test.h +20 -0
- data/ext/mathematical/mtex2MML/tests/cornercases.c +45 -0
- data/ext/mathematical/mtex2MML/tests/deps/file2str/file2str.c +64 -0
- data/ext/mathematical/mtex2MML/tests/deps/file2str/file2str.h +12 -0
- data/ext/mathematical/mtex2MML/tests/deps/trim/trim.c +24 -0
- data/ext/mathematical/mtex2MML/tests/deps/trim/trim.h +7 -0
- data/ext/mathematical/mtex2MML/tests/env.c +333 -0
- data/ext/mathematical/mtex2MML/tests/functions.c +45 -0
- data/ext/mathematical/mtex2MML/tests/helpers.c +27 -0
- data/ext/mathematical/mtex2MML/tests/helpers.h +8 -0
- data/ext/mathematical/mtex2MML/tests/main.c +35 -0
- data/ext/mathematical/mtex2MML/tests/maliciousness.c +82 -0
- data/ext/mathematical/mtex2MML/tests/mathjax.c +2030 -0
- data/ext/mathematical/mtex2MML/tests/numbered_equations.c +47 -0
- data/lib/mathematical.rb +3 -48
- data/lib/mathematical/validator.rb +52 -0
- data/lib/mathematical/version.rb +1 -1
- data/test/mathematical/basic_test.rb +7 -0
- data/test/mathematical/maliciousness_test.rb +26 -1
- data/test/mathematical/mathjax_test.rb +2 -2
- metadata +31 -7
- data/ext/mathematical/mtex2MML/ext/extconf.rb +0 -4
@@ -0,0 +1,66 @@
|
|
1
|
+
|
2
|
+
static void clar_print_init(int test_count, int suite_count, const char *suite_names)
|
3
|
+
{
|
4
|
+
(void)test_count;
|
5
|
+
printf("Loaded %d suites: %s\n", (int)suite_count, suite_names);
|
6
|
+
printf("Started\n");
|
7
|
+
}
|
8
|
+
|
9
|
+
static void clar_print_shutdown(int test_count, int suite_count, int error_count)
|
10
|
+
{
|
11
|
+
(void)test_count;
|
12
|
+
(void)suite_count;
|
13
|
+
(void)error_count;
|
14
|
+
|
15
|
+
printf("\n\n");
|
16
|
+
clar_report_errors();
|
17
|
+
}
|
18
|
+
|
19
|
+
static void clar_print_error(int num, const struct clar_error *error)
|
20
|
+
{
|
21
|
+
printf(" %d) Failure:\n", num);
|
22
|
+
|
23
|
+
printf("%s::%s [%s:%d]\n",
|
24
|
+
error->suite,
|
25
|
+
error->test,
|
26
|
+
error->file,
|
27
|
+
error->line_number);
|
28
|
+
|
29
|
+
printf(" %s\n", error->error_msg);
|
30
|
+
|
31
|
+
if (error->description != NULL)
|
32
|
+
printf(" %s\n", error->description);
|
33
|
+
|
34
|
+
printf("\n");
|
35
|
+
fflush(stdout);
|
36
|
+
}
|
37
|
+
|
38
|
+
static void clar_print_ontest(const char *test_name, int test_number, enum cl_test_status status)
|
39
|
+
{
|
40
|
+
(void)test_name;
|
41
|
+
(void)test_number;
|
42
|
+
|
43
|
+
switch(status) {
|
44
|
+
case CL_TEST_OK: printf("."); break;
|
45
|
+
case CL_TEST_FAILURE: printf("F"); break;
|
46
|
+
case CL_TEST_SKIP: printf("S"); break;
|
47
|
+
}
|
48
|
+
|
49
|
+
fflush(stdout);
|
50
|
+
}
|
51
|
+
|
52
|
+
static void clar_print_onsuite(const char *suite_name, int suite_index)
|
53
|
+
{
|
54
|
+
if (_clar.report_suite_names)
|
55
|
+
printf("\n%s", suite_name);
|
56
|
+
|
57
|
+
(void)suite_index;
|
58
|
+
}
|
59
|
+
|
60
|
+
static void clar_print_onabort(const char *msg, ...)
|
61
|
+
{
|
62
|
+
va_list argp;
|
63
|
+
va_start(argp, msg);
|
64
|
+
vfprintf(stderr, msg, argp);
|
65
|
+
va_end(argp);
|
66
|
+
}
|
@@ -0,0 +1,139 @@
|
|
1
|
+
static char _clar_path[4096];
|
2
|
+
|
3
|
+
static int
|
4
|
+
is_valid_tmp_path(const char *path)
|
5
|
+
{
|
6
|
+
STAT_T st;
|
7
|
+
|
8
|
+
if (stat(path, &st) != 0)
|
9
|
+
return 0;
|
10
|
+
|
11
|
+
if (!S_ISDIR(st.st_mode))
|
12
|
+
return 0;
|
13
|
+
|
14
|
+
return (access(path, W_OK) == 0);
|
15
|
+
}
|
16
|
+
|
17
|
+
static int
|
18
|
+
find_tmp_path(char *buffer, size_t length)
|
19
|
+
{
|
20
|
+
#ifndef _WIN32
|
21
|
+
static const size_t var_count = 5;
|
22
|
+
static const char *env_vars[] = {
|
23
|
+
"CLAR_TMP", "TMPDIR", "TMP", "TEMP", "USERPROFILE"
|
24
|
+
};
|
25
|
+
|
26
|
+
size_t i;
|
27
|
+
|
28
|
+
for (i = 0; i < var_count; ++i) {
|
29
|
+
const char *env = getenv(env_vars[i]);
|
30
|
+
if (!env)
|
31
|
+
continue;
|
32
|
+
|
33
|
+
if (is_valid_tmp_path(env)) {
|
34
|
+
strncpy(buffer, env, length);
|
35
|
+
return 0;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
/* If the environment doesn't say anything, try to use /tmp */
|
40
|
+
if (is_valid_tmp_path("/tmp")) {
|
41
|
+
strncpy(buffer, "/tmp", length);
|
42
|
+
return 0;
|
43
|
+
}
|
44
|
+
|
45
|
+
#else
|
46
|
+
DWORD env_len = GetEnvironmentVariable("CLAR_TMP", buffer, (DWORD)length);
|
47
|
+
if (env_len > 0 && env_len < (DWORD)length)
|
48
|
+
return 0;
|
49
|
+
|
50
|
+
if (GetTempPath((DWORD)length, buffer))
|
51
|
+
return 0;
|
52
|
+
#endif
|
53
|
+
|
54
|
+
/* This system doesn't like us, try to use the current directory */
|
55
|
+
if (is_valid_tmp_path(".")) {
|
56
|
+
strncpy(buffer, ".", length);
|
57
|
+
return 0;
|
58
|
+
}
|
59
|
+
|
60
|
+
return -1;
|
61
|
+
}
|
62
|
+
|
63
|
+
static void clar_unsandbox(void)
|
64
|
+
{
|
65
|
+
if (_clar_path[0] == '\0')
|
66
|
+
return;
|
67
|
+
|
68
|
+
chdir("..");
|
69
|
+
|
70
|
+
fs_rm(_clar_path);
|
71
|
+
}
|
72
|
+
|
73
|
+
static int build_sandbox_path(void)
|
74
|
+
{
|
75
|
+
#ifdef CLAR_TMPDIR
|
76
|
+
const char path_tail[] = CLAR_TMPDIR "_XXXXXX";
|
77
|
+
#else
|
78
|
+
const char path_tail[] = "clar_tmp_XXXXXX";
|
79
|
+
#endif
|
80
|
+
|
81
|
+
size_t len;
|
82
|
+
|
83
|
+
if (find_tmp_path(_clar_path, sizeof(_clar_path)) < 0)
|
84
|
+
return -1;
|
85
|
+
|
86
|
+
len = strlen(_clar_path);
|
87
|
+
|
88
|
+
#ifdef _WIN32
|
89
|
+
{ /* normalize path to POSIX forward slashes */
|
90
|
+
size_t i;
|
91
|
+
for (i = 0; i < len; ++i) {
|
92
|
+
if (_clar_path[i] == '\\')
|
93
|
+
_clar_path[i] = '/';
|
94
|
+
}
|
95
|
+
}
|
96
|
+
#endif
|
97
|
+
|
98
|
+
if (_clar_path[len - 1] != '/') {
|
99
|
+
_clar_path[len++] = '/';
|
100
|
+
}
|
101
|
+
|
102
|
+
strncpy(_clar_path + len, path_tail, sizeof(_clar_path) - len);
|
103
|
+
|
104
|
+
#if defined(__MINGW32__)
|
105
|
+
if (_mktemp(_clar_path) == NULL)
|
106
|
+
return -1;
|
107
|
+
|
108
|
+
if (mkdir(_clar_path, 0700) != 0)
|
109
|
+
return -1;
|
110
|
+
#elif defined(_WIN32)
|
111
|
+
if (_mktemp_s(_clar_path, sizeof(_clar_path)) != 0)
|
112
|
+
return -1;
|
113
|
+
|
114
|
+
if (mkdir(_clar_path, 0700) != 0)
|
115
|
+
return -1;
|
116
|
+
#else
|
117
|
+
if (mkdtemp(_clar_path) == NULL)
|
118
|
+
return -1;
|
119
|
+
#endif
|
120
|
+
|
121
|
+
return 0;
|
122
|
+
}
|
123
|
+
|
124
|
+
static int clar_sandbox(void)
|
125
|
+
{
|
126
|
+
if (_clar_path[0] == '\0' && build_sandbox_path() < 0)
|
127
|
+
return -1;
|
128
|
+
|
129
|
+
if (chdir(_clar_path) != 0)
|
130
|
+
return -1;
|
131
|
+
|
132
|
+
return 0;
|
133
|
+
}
|
134
|
+
|
135
|
+
const char *clar_sandbox_path(void)
|
136
|
+
{
|
137
|
+
return _clar_path;
|
138
|
+
}
|
139
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) Vicent Marti. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of clar, distributed under the ISC license.
|
5
|
+
* For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
#ifndef __CLAR_TEST__
|
8
|
+
#define __CLAR_TEST__
|
9
|
+
|
10
|
+
/* Import the standard clar helper functions */
|
11
|
+
#include "clar.h"
|
12
|
+
|
13
|
+
/* Your custom shared includes / defines here */
|
14
|
+
extern int global_test_counter;
|
15
|
+
|
16
|
+
#include "helpers.h"
|
17
|
+
#include "../src/mtex2MML.h"
|
18
|
+
#include "deps/file2str/file2str.h"
|
19
|
+
|
20
|
+
#endif
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#include "clar.h"
|
2
|
+
#include "clar_test.h"
|
3
|
+
#include <stdio.h>
|
4
|
+
|
5
|
+
static char *fixture_tex;
|
6
|
+
static char *fixture_mml;
|
7
|
+
static char *result;
|
8
|
+
|
9
|
+
void test_cornercases__initialize(void)
|
10
|
+
{
|
11
|
+
global_test_counter++;
|
12
|
+
}
|
13
|
+
|
14
|
+
void test_cornercases__cleanup(void)
|
15
|
+
{
|
16
|
+
if (fixture_tex != NULL) {
|
17
|
+
free(fixture_tex);
|
18
|
+
}
|
19
|
+
|
20
|
+
if (fixture_mml != NULL) {
|
21
|
+
free(fixture_mml);
|
22
|
+
}
|
23
|
+
|
24
|
+
if (result != NULL) {
|
25
|
+
free(result);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
void test_cornercases__broken_up_inline_env(void)
|
30
|
+
{
|
31
|
+
fixture_tex = read_fixture_tex("cornercases/broken_up_inline_env.txt");
|
32
|
+
fixture_mml = read_fixture_mml("cornercases/broken_up_inline_env.html");
|
33
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
34
|
+
|
35
|
+
cl_assert_equal_s(fixture_mml, result);
|
36
|
+
}
|
37
|
+
|
38
|
+
void test_cornercases__some_crazy_alignment(void)
|
39
|
+
{
|
40
|
+
fixture_tex = read_fixture_tex("cornercases/some_crazy_alignment.txt");
|
41
|
+
fixture_mml = read_fixture_mml("cornercases/some_crazy_alignment.html");
|
42
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
43
|
+
|
44
|
+
cl_assert_equal_s(fixture_mml, result);
|
45
|
+
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
|
2
|
+
#include <stdio.h>
|
3
|
+
#include <stdlib.h>
|
4
|
+
#include <string.h>
|
5
|
+
|
6
|
+
char *file2strl(
|
7
|
+
const char *path,
|
8
|
+
unsigned int *file_len_out
|
9
|
+
)
|
10
|
+
{
|
11
|
+
FILE *file;
|
12
|
+
|
13
|
+
if (!(file = fopen(path, "rb")))
|
14
|
+
{
|
15
|
+
fprintf(stderr, "Unable to open file %s\n", path);
|
16
|
+
return NULL;
|
17
|
+
}
|
18
|
+
|
19
|
+
if (-1 == fseek(file, 0, SEEK_END))
|
20
|
+
{
|
21
|
+
fprintf(stderr, "Unable to seek file %s\n", path);
|
22
|
+
return NULL;
|
23
|
+
}
|
24
|
+
|
25
|
+
unsigned long file_len;
|
26
|
+
if (-1 == (file_len = ftell(file)))
|
27
|
+
{
|
28
|
+
fprintf(stderr, "Unable to ftell() file %s\n", path);
|
29
|
+
return NULL;
|
30
|
+
}
|
31
|
+
|
32
|
+
if (-1 == fseek(file, 0, SEEK_SET))
|
33
|
+
{
|
34
|
+
fprintf(stderr, "Unable to seek file %s\n", path);
|
35
|
+
return NULL;
|
36
|
+
}
|
37
|
+
|
38
|
+
char *contents;
|
39
|
+
if (!(contents = malloc(file_len + 1)))
|
40
|
+
{
|
41
|
+
fprintf(stderr, "Memory error!\n");
|
42
|
+
fclose(file);
|
43
|
+
return NULL;
|
44
|
+
}
|
45
|
+
|
46
|
+
fread(contents, file_len, 1, file);
|
47
|
+
fclose(file);
|
48
|
+
|
49
|
+
contents[file_len] = '\0';
|
50
|
+
|
51
|
+
if (file_len_out)
|
52
|
+
*file_len_out = file_len + 1;
|
53
|
+
|
54
|
+
return contents;
|
55
|
+
}
|
56
|
+
|
57
|
+
char *file2str(
|
58
|
+
const char *path,
|
59
|
+
unsigned long *file_len_out
|
60
|
+
)
|
61
|
+
{
|
62
|
+
return file2strl(path,NULL);
|
63
|
+
}
|
64
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#ifndef FILE2STR_H
|
2
|
+
#define FILE2STR_H
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @param path File's path.
|
6
|
+
* @param len Pointer to the length of the string returned
|
7
|
+
* @return string contents of file; otherwise NULL on error */
|
8
|
+
char *file2strl(const char *path, unsigned int *len);
|
9
|
+
|
10
|
+
char *file2str(const char *path);
|
11
|
+
|
12
|
+
#endif /* FILE2STR_H */
|
@@ -0,0 +1,24 @@
|
|
1
|
+
char *
|
2
|
+
trim(char *str)
|
3
|
+
{
|
4
|
+
char *end;
|
5
|
+
|
6
|
+
// ltrim
|
7
|
+
while (isspace(*str)) {
|
8
|
+
str++;
|
9
|
+
}
|
10
|
+
|
11
|
+
if (*str == 0) // only spaces
|
12
|
+
return str;
|
13
|
+
|
14
|
+
// rtrim
|
15
|
+
end = str + strlen(str) - 1;
|
16
|
+
while (end > str && isspace(*end)) {
|
17
|
+
end--;
|
18
|
+
}
|
19
|
+
|
20
|
+
// null terminator
|
21
|
+
*(end+1) = 0;
|
22
|
+
|
23
|
+
return str;
|
24
|
+
}
|
@@ -0,0 +1,333 @@
|
|
1
|
+
#include "clar.h"
|
2
|
+
#include "clar_test.h"
|
3
|
+
#include <stdio.h>
|
4
|
+
|
5
|
+
static char *fixture_tex;
|
6
|
+
static char *fixture_mml;
|
7
|
+
static char *result;
|
8
|
+
|
9
|
+
void test_env__initialize(void)
|
10
|
+
{
|
11
|
+
global_test_counter++;
|
12
|
+
}
|
13
|
+
|
14
|
+
void test_env__cleanup(void)
|
15
|
+
{
|
16
|
+
if (fixture_tex != NULL) {
|
17
|
+
free(fixture_tex);
|
18
|
+
}
|
19
|
+
|
20
|
+
if (fixture_mml != NULL) {
|
21
|
+
free(fixture_mml);
|
22
|
+
}
|
23
|
+
|
24
|
+
if (result != NULL) {
|
25
|
+
free(result);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
void test_env__matrix_ex_spacing(void)
|
30
|
+
{
|
31
|
+
fixture_tex = read_fixture_tex("env/matrix_ex_spacing.txt");
|
32
|
+
fixture_mml = read_fixture_mml("env/matrix_ex_spacing.html");
|
33
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
34
|
+
|
35
|
+
cl_assert_equal_s(fixture_mml, result);
|
36
|
+
}
|
37
|
+
|
38
|
+
void test_env__matrix_no_ex_spacing(void)
|
39
|
+
{
|
40
|
+
fixture_tex = read_fixture_tex("env/matrix_no_ex_spacing.txt");
|
41
|
+
fixture_mml = read_fixture_mml("env/matrix_no_ex_spacing.html");
|
42
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
43
|
+
|
44
|
+
cl_assert_equal_s(fixture_mml, result);
|
45
|
+
}
|
46
|
+
|
47
|
+
void test_env__matrix_no_lines(void)
|
48
|
+
{
|
49
|
+
fixture_tex = read_fixture_tex("env/matrix_no_lines.txt");
|
50
|
+
fixture_mml = read_fixture_mml("env/matrix_no_lines.html");
|
51
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
52
|
+
|
53
|
+
cl_assert_equal_s(fixture_mml, result);
|
54
|
+
}
|
55
|
+
|
56
|
+
void test_env__pmatrix_ex_spacing(void)
|
57
|
+
{
|
58
|
+
fixture_tex = read_fixture_tex("env/pmatrix_ex_spacing.txt");
|
59
|
+
fixture_mml = read_fixture_mml("env/pmatrix_ex_spacing.html");
|
60
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
61
|
+
|
62
|
+
cl_assert_equal_s(fixture_mml, result);
|
63
|
+
}
|
64
|
+
|
65
|
+
void test_env__pmatrix_no_ex_spacing(void)
|
66
|
+
{
|
67
|
+
fixture_tex = read_fixture_tex("env/pmatrix_no_ex_spacing.txt");
|
68
|
+
fixture_mml = read_fixture_mml("env/pmatrix_no_ex_spacing.html");
|
69
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
70
|
+
|
71
|
+
cl_assert_equal_s(fixture_mml, result);
|
72
|
+
}
|
73
|
+
|
74
|
+
void test_env__pmatrix_no_lines(void)
|
75
|
+
{
|
76
|
+
fixture_tex = read_fixture_tex("env/pmatrix_no_lines.txt");
|
77
|
+
fixture_mml = read_fixture_mml("env/pmatrix_no_lines.html");
|
78
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
79
|
+
|
80
|
+
cl_assert_equal_s(fixture_mml, result);
|
81
|
+
}
|
82
|
+
|
83
|
+
void test_env__bmatrix_ex_spacing(void)
|
84
|
+
{
|
85
|
+
fixture_tex = read_fixture_tex("env/bmatrix_ex_spacing.txt");
|
86
|
+
fixture_mml = read_fixture_mml("env/bmatrix_ex_spacing.html");
|
87
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
88
|
+
|
89
|
+
cl_assert_equal_s(fixture_mml, result);
|
90
|
+
}
|
91
|
+
|
92
|
+
void test_env__bmatrix_no_ex_spacing(void)
|
93
|
+
{
|
94
|
+
fixture_tex = read_fixture_tex("env/bmatrix_no_ex_spacing.txt");
|
95
|
+
fixture_mml = read_fixture_mml("env/bmatrix_no_ex_spacing.html");
|
96
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
97
|
+
|
98
|
+
cl_assert_equal_s(fixture_mml, result);
|
99
|
+
}
|
100
|
+
|
101
|
+
void test_env__bmatrix_no_lines(void)
|
102
|
+
{
|
103
|
+
fixture_tex = read_fixture_tex("env/bmatrix_no_lines.txt");
|
104
|
+
fixture_mml = read_fixture_mml("env/bmatrix_no_lines.html");
|
105
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
106
|
+
|
107
|
+
cl_assert_equal_s(fixture_mml, result);
|
108
|
+
}
|
109
|
+
|
110
|
+
void test_env__bbmatrix_ex_spacing(void)
|
111
|
+
{
|
112
|
+
fixture_tex = read_fixture_tex("env/bbmatrix_ex_spacing.txt");
|
113
|
+
fixture_mml = read_fixture_mml("env/bbmatrix_ex_spacing.html");
|
114
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
115
|
+
|
116
|
+
cl_assert_equal_s(fixture_mml, result);
|
117
|
+
}
|
118
|
+
|
119
|
+
void test_env__bbmatrix_no_ex_spacing(void)
|
120
|
+
{
|
121
|
+
fixture_tex = read_fixture_tex("env/bbmatrix_no_ex_spacing.txt");
|
122
|
+
fixture_mml = read_fixture_mml("env/bbmatrix_no_ex_spacing.html");
|
123
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
124
|
+
|
125
|
+
cl_assert_equal_s(fixture_mml, result);
|
126
|
+
}
|
127
|
+
|
128
|
+
void test_env__bbmatrix_no_lines(void)
|
129
|
+
{
|
130
|
+
fixture_tex = read_fixture_tex("env/bbmatrix_no_lines.txt");
|
131
|
+
fixture_mml = read_fixture_mml("env/bbmatrix_no_lines.html");
|
132
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
133
|
+
|
134
|
+
cl_assert_equal_s(fixture_mml, result);
|
135
|
+
}
|
136
|
+
|
137
|
+
void test_env__vmatrix_ex_spacing(void)
|
138
|
+
{
|
139
|
+
fixture_tex = read_fixture_tex("env/vmatrix_ex_spacing.txt");
|
140
|
+
fixture_mml = read_fixture_mml("env/vmatrix_ex_spacing.html");
|
141
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
142
|
+
|
143
|
+
cl_assert_equal_s(fixture_mml, result);
|
144
|
+
}
|
145
|
+
|
146
|
+
void test_env__vmatrix_no_ex_spacing(void)
|
147
|
+
{
|
148
|
+
fixture_tex = read_fixture_tex("env/vmatrix_no_ex_spacing.txt");
|
149
|
+
fixture_mml = read_fixture_mml("env/vmatrix_no_ex_spacing.html");
|
150
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
151
|
+
|
152
|
+
cl_assert_equal_s(fixture_mml, result);
|
153
|
+
}
|
154
|
+
|
155
|
+
void test_env__vmatrix_no_lines(void)
|
156
|
+
{
|
157
|
+
fixture_tex = read_fixture_tex("env/vmatrix_no_lines.txt");
|
158
|
+
fixture_mml = read_fixture_mml("env/vmatrix_no_lines.html");
|
159
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
160
|
+
|
161
|
+
cl_assert_equal_s(fixture_mml, result);
|
162
|
+
}
|
163
|
+
|
164
|
+
void test_env__vvmatrix_ex_spacing(void)
|
165
|
+
{
|
166
|
+
fixture_tex = read_fixture_tex("env/vvmatrix_ex_spacing.txt");
|
167
|
+
fixture_mml = read_fixture_mml("env/vvmatrix_ex_spacing.html");
|
168
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
169
|
+
|
170
|
+
cl_assert_equal_s(fixture_mml, result);
|
171
|
+
}
|
172
|
+
|
173
|
+
void test_env__vvmatrix_no_ex_spacing(void)
|
174
|
+
{
|
175
|
+
fixture_tex = read_fixture_tex("env/vvmatrix_no_ex_spacing.txt");
|
176
|
+
fixture_mml = read_fixture_mml("env/vvmatrix_no_ex_spacing.html");
|
177
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
178
|
+
|
179
|
+
cl_assert_equal_s(fixture_mml, result);
|
180
|
+
}
|
181
|
+
|
182
|
+
void test_env__vvmatrix_no_lines(void)
|
183
|
+
{
|
184
|
+
fixture_tex = read_fixture_tex("env/vvmatrix_no_lines.txt");
|
185
|
+
fixture_mml = read_fixture_mml("env/vvmatrix_no_lines.html");
|
186
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
187
|
+
|
188
|
+
cl_assert_equal_s(fixture_mml, result);
|
189
|
+
}
|
190
|
+
|
191
|
+
void test_env__smallmatrix_ex_spacing(void)
|
192
|
+
{
|
193
|
+
fixture_tex = read_fixture_tex("env/smallmatrix_ex_spacing.txt");
|
194
|
+
fixture_mml = read_fixture_mml("env/smallmatrix_ex_spacing.html");
|
195
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
196
|
+
|
197
|
+
cl_assert_equal_s(fixture_mml, result);
|
198
|
+
}
|
199
|
+
|
200
|
+
void test_env__smallmatrix_no_ex_spacing(void)
|
201
|
+
{
|
202
|
+
fixture_tex = read_fixture_tex("env/smallmatrix_no_ex_spacing.txt");
|
203
|
+
fixture_mml = read_fixture_mml("env/smallmatrix_no_ex_spacing.html");
|
204
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
205
|
+
|
206
|
+
cl_assert_equal_s(fixture_mml, result);
|
207
|
+
}
|
208
|
+
|
209
|
+
void test_env__smallmatrix_no_lines(void)
|
210
|
+
{
|
211
|
+
fixture_tex = read_fixture_tex("env/smallmatrix_no_lines.txt");
|
212
|
+
fixture_mml = read_fixture_mml("env/smallmatrix_no_lines.html");
|
213
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
214
|
+
|
215
|
+
cl_assert_equal_s(fixture_mml, result);
|
216
|
+
}
|
217
|
+
|
218
|
+
void test_env__aligned_ex_spacing(void)
|
219
|
+
{
|
220
|
+
fixture_tex = read_fixture_tex("env/aligned_ex_spacing.txt");
|
221
|
+
fixture_mml = read_fixture_mml("env/aligned_ex_spacing.html");
|
222
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
223
|
+
|
224
|
+
cl_assert_equal_s(fixture_mml, result);
|
225
|
+
}
|
226
|
+
|
227
|
+
void test_env__aligned_no_ex_spacing(void)
|
228
|
+
{
|
229
|
+
fixture_tex = read_fixture_tex("env/aligned_no_ex_spacing.txt");
|
230
|
+
fixture_mml = read_fixture_mml("env/aligned_no_ex_spacing.html");
|
231
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
232
|
+
|
233
|
+
cl_assert_equal_s(fixture_mml, result);
|
234
|
+
}
|
235
|
+
|
236
|
+
void test_env__aligned_no_lines(void)
|
237
|
+
{
|
238
|
+
fixture_tex = read_fixture_tex("env/aligned_no_lines.txt");
|
239
|
+
fixture_mml = read_fixture_mml("env/aligned_no_lines.html");
|
240
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
241
|
+
|
242
|
+
cl_assert_equal_s(fixture_mml, result);
|
243
|
+
}
|
244
|
+
|
245
|
+
void test_env__gathered_ex_spacing(void)
|
246
|
+
{
|
247
|
+
fixture_tex = read_fixture_tex("env/gathered_ex_spacing.txt");
|
248
|
+
fixture_mml = read_fixture_mml("env/gathered_ex_spacing.html");
|
249
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
250
|
+
|
251
|
+
cl_assert_equal_s(fixture_mml, result);
|
252
|
+
}
|
253
|
+
|
254
|
+
void test_env__gathered_no_ex_spacing(void)
|
255
|
+
{
|
256
|
+
fixture_tex = read_fixture_tex("env/gathered_no_ex_spacing.txt");
|
257
|
+
fixture_mml = read_fixture_mml("env/gathered_no_ex_spacing.html");
|
258
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
259
|
+
|
260
|
+
cl_assert_equal_s(fixture_mml, result);
|
261
|
+
}
|
262
|
+
|
263
|
+
void test_env__gathered_no_lines(void)
|
264
|
+
{
|
265
|
+
fixture_tex = read_fixture_tex("env/gathered_no_lines.txt");
|
266
|
+
fixture_mml = read_fixture_mml("env/gathered_no_lines.html");
|
267
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
268
|
+
|
269
|
+
cl_assert_equal_s(fixture_mml, result);
|
270
|
+
}
|
271
|
+
|
272
|
+
void test_env__split_ex_spacing(void)
|
273
|
+
{
|
274
|
+
fixture_tex = read_fixture_tex("env/split_ex_spacing.txt");
|
275
|
+
fixture_mml = read_fixture_mml("env/split_ex_spacing.html");
|
276
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
277
|
+
|
278
|
+
cl_assert_equal_s(fixture_mml, result);
|
279
|
+
}
|
280
|
+
|
281
|
+
void test_env__split_no_ex_spacing(void)
|
282
|
+
{
|
283
|
+
fixture_tex = read_fixture_tex("env/split_no_ex_spacing.txt");
|
284
|
+
fixture_mml = read_fixture_mml("env/split_no_ex_spacing.html");
|
285
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
286
|
+
|
287
|
+
cl_assert_equal_s(fixture_mml, result);
|
288
|
+
}
|
289
|
+
|
290
|
+
void test_env__split_no_lines(void)
|
291
|
+
{
|
292
|
+
fixture_tex = read_fixture_tex("env/split_no_lines.txt");
|
293
|
+
fixture_mml = read_fixture_mml("env/split_no_lines.html");
|
294
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
295
|
+
|
296
|
+
cl_assert_equal_s(fixture_mml, result);
|
297
|
+
}
|
298
|
+
|
299
|
+
void test_env__spaces_after_rowsep(void)
|
300
|
+
{
|
301
|
+
fixture_tex = read_fixture_tex("env/spaces_after_rowsep.txt");
|
302
|
+
fixture_mml = read_fixture_mml("env/spaces_after_rowsep.html");
|
303
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
304
|
+
|
305
|
+
cl_assert_equal_s(fixture_mml, result);
|
306
|
+
}
|
307
|
+
|
308
|
+
void test_env__cases_ex_spacing(void)
|
309
|
+
{
|
310
|
+
fixture_tex = read_fixture_tex("env/cases_ex_spacing.txt");
|
311
|
+
fixture_mml = read_fixture_mml("env/cases_ex_spacing.html");
|
312
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
313
|
+
|
314
|
+
cl_assert_equal_s(fixture_mml, result);
|
315
|
+
}
|
316
|
+
|
317
|
+
void test_env__cases_no_ex_spacing(void)
|
318
|
+
{
|
319
|
+
fixture_tex = read_fixture_tex("env/cases_no_ex_spacing.txt");
|
320
|
+
fixture_mml = read_fixture_mml("env/cases_no_ex_spacing.html");
|
321
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
322
|
+
|
323
|
+
cl_assert_equal_s(fixture_mml, result);
|
324
|
+
}
|
325
|
+
|
326
|
+
void test_env__cases_no_lines(void)
|
327
|
+
{
|
328
|
+
fixture_tex = read_fixture_tex("env/cases_no_lines.txt");
|
329
|
+
fixture_mml = read_fixture_mml("env/cases_no_lines.html");
|
330
|
+
result = mtex2MML_parse(fixture_tex, strlen(fixture_tex));
|
331
|
+
|
332
|
+
cl_assert_equal_s(fixture_mml, result);
|
333
|
+
}
|