summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/lualatex/lualatex-math/test-unicode.tex
blob: 1551142aaa336aa8973a0f82d8f2fd0ef36047fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
%%
%% This is file `test-unicode.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% lualatex-math.dtx  (with options: `test,test-unicode')
%% 
%% This is a generated file.
%% 
%% Copyright 2011 by Philipp Stephani
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version.  The latest version of this license is in
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3c or later is part of all distributions of
%% LaTeX version 2009/09/24 or later.
%% 
\documentclass[pagesize=auto]{scrartcl}
\usepackage{xparse}[2008/08/03]
\ExplSyntaxOn
\msg_new:nnn { test } { pass } { #1 }
\cs_new_protected_nopar:Npn \test_pass:x #1 {
  \msg_info:nnx { test } { pass } { #1 }
}
\msg_new:nnn { test } { fail } { #1 }
\cs_new_protected_nopar:Npn \test_fail:x #1 {
  \msg_error:nnx { test } { fail } { #1 }
}
\cs_generate_variant:Nn \tl_const:Nn { Nx }
\tl_const:Nx \c_test_equal_tl { \c_space_tl == \c_space_tl }
\tl_const:Nx \c_test_not_equal_tl { \c_space_tl != \c_space_tl }
\cs_new_protected_nopar:Npn \test_equal_pass:nxnx #1 #2 #3 #4 {
  \test_pass:x {
    \exp_not:n { #1 }
    \c_test_equal_tl
    #2
    \c_test_equal_tl
    #4
    \c_test_equal_tl
    \exp_not:n { #3 }
  }
}
\cs_new_protected_nopar:Npn \test_equal_fail:nxnx #1 #2 #3 #4 {
  \test_fail:x {
    \exp_not:n { #1 }
    \c_test_equal_tl
    #2
    \c_test_not_equal_tl
    #4
    \c_test_equal_tl
    \exp_not:n { #3 }
  }
}
\cs_new_protected_nopar:Npn
\test_assert_equal:NNNNNnn #1 #2 #3 #4 #5 #6 #7 {
  #1 #4 { #6 }
  #1 #5 { #7 }
  #3 { #4 } = { #5 } {
    \test_equal_pass:nxnx { #6 } { #2 #4 } { #7 } { #2 #5 }
  } {
    \test_equal_fail:nxnx { #6 } { #2 #4 } { #7 } { #2 #5 }
  }
}
\cs_generate_variant:Nn \test_assert_equal:NNNNNnn { ccccc }
\cs_new_protected_nopar:Npn \test_assert_equal:nnn #1 #2 #3 {
  \test_assert_equal:cccccnn
    { #1 _set:Nn } { #1 _use:N } { #1 _compare:nNnTF }
    { l_test_tmpa_ #1 } { l_test_tmpb_ #1 } { #2 } { #3 }
}
\int_new:N \l_test_tmpa_int
\int_new:N \l_test_tmpb_int
\NewDocumentCommand \AssertIntEqual { m m } {
  \test_assert_equal:nnn { int } { #1 } { #2 }
}
\dim_new:N \l_test_tmpa_dim
\dim_new:N \l_test_tmpb_dim
\NewDocumentCommand \AssertDimEqual { m m } {
  \test_assert_equal:nnn { dim } { #1 } { #2 }
}
\NewDocumentCommand \AssertMathStyle { m } {
  \AssertIntEqual { \luatexmathstyle } { #1 }
}
\cs_new_protected_nopar:Npn \test_assert_cramped:Nx #1 #2 {
  \int_set:Nn \l_test_tmpa_int { \luatexmathstyle }
  \bool_if:nTF {
    \int_compare_p:nNn { \l_test_tmpa_int } > { \c_minus_one }
    &&
    #1 { \l_test_tmpa_int }
  } {
    \test_pass:x {
      \exp_not:N \luatexmathstyle
      \c_test_equal_tl
      \int_use:N \l_test_tmpa_int
      \c_space_tl
      is~ a~ #2~ style
    }
  } {
    \test_fail:x {
      \exp_not:N \luatexmathstyle
      \c_test_equal_tl
      \int_use:N \l_test_tmpa_int
      \c_space_tl
      is~ not~ a~ #2~ style
    }
  }
}
\NewDocumentCommand \AssertNoncrampedStyle { } {
  \test_assert_cramped:Nx \int_if_even_p:n { non-cramped }
}
\NewDocumentCommand \AssertCrampedStyle { } {
  \test_assert_cramped:Nx \int_if_odd_p:n { cramped }
}
\ExplSyntaxOff
\ExplSyntaxOn
\msg_redirect_class:nn { warning } { error }
\ExplSyntaxOff
\usepackage{amsmath}
\usepackage{unicode-math}[2011/05/05]
\setmathfont{XITS Math}
\usepackage{lualatex-math}
\begin{document}
\begin{equation*}
  \AssertMathStyle{0} \sqrt{\AssertMathStyle{1}}
  \frac{\AssertMathStyle{2}}{\AssertMathStyle{3}}
  a^{\frac{\AssertMathStyle{6}}{\AssertMathStyle{7}}}
  \dfrac{\AssertMathStyle{2}}{\AssertMathStyle{3}}
  \tfrac{\AssertMathStyle{4}}{\AssertMathStyle{5}}
\end{equation*}
\end{document}
\endinput
%%
%% End of file `test-unicode.tex'.