mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/legion/kbd.git
synced 2026-01-26 06:07:55 +00:00
tests: Add tests to increase code coverage
Signed-off-by: Alexey Gladkov <legion@kernel.org>
This commit is contained in:
parent
c5c85065bf
commit
854faf77da
1
.gitignore
vendored
1
.gitignore
vendored
@ -97,6 +97,7 @@ tests/helpers/libkeymap-bkeymap
|
||||
tests/helpers/libkeymap-dumpkeys
|
||||
tests/helpers/libkeymap-mktable
|
||||
tests/helpers/libkeymap-showmaps
|
||||
tests/libcommon/libcommon-test[0-9][0-9]
|
||||
tests/libkbdfile/libkbdfile-test[0-9][0-9]
|
||||
tests/libkeymap/libkeymap-test[0-9][0-9]
|
||||
tests/testsuite
|
||||
|
||||
@ -247,6 +247,7 @@ AC_CONFIG_FILES([Makefile
|
||||
src/libkeymap/Makefile
|
||||
src/vlock/Makefile
|
||||
tests/helpers/Makefile
|
||||
tests/libcommon/Makefile
|
||||
tests/libkbdfile/Makefile
|
||||
tests/libkeymap/Makefile
|
||||
tests/Makefile
|
||||
|
||||
@ -2,6 +2,7 @@ NULL =
|
||||
|
||||
SUBDIRS = \
|
||||
helpers \
|
||||
libcommon \
|
||||
libkbdfile \
|
||||
libkeymap \
|
||||
$(NULL)
|
||||
|
||||
892
tests/data/keymap0-summary.txt
Normal file
892
tests/data/keymap0-summary.txt
Normal file
@ -0,0 +1,892 @@
|
||||
keycode range supported by kernel: 1 - 255
|
||||
max number of actions bindable to a key: 256
|
||||
number of keymaps in actual use: 1
|
||||
of which 0 dynamically allocated
|
||||
ranges of action codes supported by kernel:
|
||||
number of function keys supported by kernel: 256
|
||||
max nr of compose definitions: 256
|
||||
nr of compose definitions in actual use: 0
|
||||
0x0000 nul
|
||||
0x0001 Control_a
|
||||
0x0002 Control_b
|
||||
0x0003 Control_c
|
||||
0x0004 Control_d
|
||||
0x0005 Control_e
|
||||
0x0006 Control_f
|
||||
0x0007 Control_g
|
||||
0x0008 BackSpace
|
||||
0x0009 Tab
|
||||
0x000a Linefeed
|
||||
0x000b Control_k
|
||||
0x000c Control_l
|
||||
0x000d Control_m
|
||||
0x000e Control_n
|
||||
0x000f Control_o
|
||||
0x0010 Control_p
|
||||
0x0011 Control_q
|
||||
0x0012 Control_r
|
||||
0x0013 Control_s
|
||||
0x0014 Control_t
|
||||
0x0015 Control_u
|
||||
0x0016 Control_v
|
||||
0x0017 Control_w
|
||||
0x0018 Control_x
|
||||
0x0019 Control_y
|
||||
0x001a Control_z
|
||||
0x001b Escape
|
||||
0x001c Control_backslash
|
||||
0x001d Control_bracketright
|
||||
0x001e Control_asciicircum
|
||||
0x001f Control_underscore
|
||||
0x0020 space
|
||||
0x0021 exclam
|
||||
0x0022 quotedbl
|
||||
0x0023 numbersign
|
||||
0x0024 dollar
|
||||
0x0025 percent
|
||||
0x0026 ampersand
|
||||
0x0027 apostrophe
|
||||
0x0028 parenleft
|
||||
0x0029 parenright
|
||||
0x002a asterisk
|
||||
0x002b plus
|
||||
0x002c comma
|
||||
0x002d minus
|
||||
0x002e period
|
||||
0x002f slash
|
||||
0x0030 zero
|
||||
0x0031 one
|
||||
0x0032 two
|
||||
0x0033 three
|
||||
0x0034 four
|
||||
0x0035 five
|
||||
0x0036 six
|
||||
0x0037 seven
|
||||
0x0038 eight
|
||||
0x0039 nine
|
||||
0x003a colon
|
||||
0x003b semicolon
|
||||
0x003c less
|
||||
0x003d equal
|
||||
0x003e greater
|
||||
0x003f question
|
||||
0x0040 at
|
||||
0x0041 A
|
||||
0x0042 B
|
||||
0x0043 C
|
||||
0x0044 D
|
||||
0x0045 E
|
||||
0x0046 F
|
||||
0x0047 G
|
||||
0x0048 H
|
||||
0x0049 I
|
||||
0x004a J
|
||||
0x004b K
|
||||
0x004c L
|
||||
0x004d M
|
||||
0x004e N
|
||||
0x004f O
|
||||
0x0050 P
|
||||
0x0051 Q
|
||||
0x0052 R
|
||||
0x0053 S
|
||||
0x0054 T
|
||||
0x0055 U
|
||||
0x0056 V
|
||||
0x0057 W
|
||||
0x0058 X
|
||||
0x0059 Y
|
||||
0x005a Z
|
||||
0x005b bracketleft
|
||||
0x005c backslash
|
||||
0x005d bracketright
|
||||
0x005e asciicircum
|
||||
0x005f underscore
|
||||
0x0060 grave
|
||||
0x0061 a
|
||||
0x0062 b
|
||||
0x0063 c
|
||||
0x0064 d
|
||||
0x0065 e
|
||||
0x0066 f
|
||||
0x0067 g
|
||||
0x0068 h
|
||||
0x0069 i
|
||||
0x006a j
|
||||
0x006b k
|
||||
0x006c l
|
||||
0x006d m
|
||||
0x006e n
|
||||
0x006f o
|
||||
0x0070 p
|
||||
0x0071 q
|
||||
0x0072 r
|
||||
0x0073 s
|
||||
0x0074 t
|
||||
0x0075 u
|
||||
0x0076 v
|
||||
0x0077 w
|
||||
0x0078 x
|
||||
0x0079 y
|
||||
0x007a z
|
||||
0x007b braceleft
|
||||
0x007c bar
|
||||
0x007d braceright
|
||||
0x007e asciitilde
|
||||
0x007f Delete
|
||||
0x00a0 nobreakspace
|
||||
0x00a1 exclamdown
|
||||
0x00a2 cent
|
||||
0x00a3 sterling
|
||||
0x00a4 currency
|
||||
0x00a5 yen
|
||||
0x00a6 brokenbar
|
||||
0x00a7 section
|
||||
0x00a8 diaeresis
|
||||
0x00a9 copyright
|
||||
0x00aa ordfeminine
|
||||
0x00ab guillemotleft
|
||||
0x00ac notsign
|
||||
0x00ad hyphen
|
||||
0x00ae registered
|
||||
0x00af macron
|
||||
0x00b0 degree
|
||||
0x00b1 plusminus
|
||||
0x00b2 twosuperior
|
||||
0x00b3 threesuperior
|
||||
0x00b4 acute
|
||||
0x00b5 mu
|
||||
0x00b6 paragraph
|
||||
0x00b7 periodcentered
|
||||
0x00b8 cedilla
|
||||
0x00b9 onesuperior
|
||||
0x00ba masculine
|
||||
0x00bb guillemotright
|
||||
0x00bc onequarter
|
||||
0x00bd onehalf
|
||||
0x00be threequarters
|
||||
0x00bf questiondown
|
||||
0x00c0 Agrave
|
||||
0x00c1 Aacute
|
||||
0x00c2 Acircumflex
|
||||
0x00c3 Atilde
|
||||
0x00c4 Adiaeresis
|
||||
0x00c5 Aring
|
||||
0x00c6 AE
|
||||
0x00c7 Ccedilla
|
||||
0x00c8 Egrave
|
||||
0x00c9 Eacute
|
||||
0x00ca Ecircumflex
|
||||
0x00cb Ediaeresis
|
||||
0x00cc Igrave
|
||||
0x00cd Iacute
|
||||
0x00ce Icircumflex
|
||||
0x00cf Idiaeresis
|
||||
0x00d0 ETH
|
||||
0x00d1 Ntilde
|
||||
0x00d2 Ograve
|
||||
0x00d3 Oacute
|
||||
0x00d4 Ocircumflex
|
||||
0x00d5 Otilde
|
||||
0x00d6 Odiaeresis
|
||||
0x00d7 multiply
|
||||
0x00d8 Ooblique
|
||||
0x00d9 Ugrave
|
||||
0x00da Uacute
|
||||
0x00db Ucircumflex
|
||||
0x00dc Udiaeresis
|
||||
0x00dd Yacute
|
||||
0x00de THORN
|
||||
0x00df ssharp
|
||||
0x00e0 agrave
|
||||
0x00e1 aacute
|
||||
0x00e2 acircumflex
|
||||
0x00e3 atilde
|
||||
0x00e4 adiaeresis
|
||||
0x00e5 aring
|
||||
0x00e6 ae
|
||||
0x00e7 ccedilla
|
||||
0x00e8 egrave
|
||||
0x00e9 eacute
|
||||
0x00ea ecircumflex
|
||||
0x00eb ediaeresis
|
||||
0x00ec igrave
|
||||
0x00ed iacute
|
||||
0x00ee icircumflex
|
||||
0x00ef idiaeresis
|
||||
0x00f0 eth
|
||||
0x00f1 ntilde
|
||||
0x00f2 ograve
|
||||
0x00f3 oacute
|
||||
0x00f4 ocircumflex
|
||||
0x00f5 otilde
|
||||
0x00f6 odiaeresis
|
||||
0x00f7 division
|
||||
0x00f8 oslash
|
||||
0x00f9 ugrave
|
||||
0x00fa uacute
|
||||
0x00fb ucircumflex
|
||||
0x00fc udiaeresis
|
||||
0x00fd yacute
|
||||
0x00fe thorn
|
||||
0x00ff ydiaeresis
|
||||
0x0100 F1
|
||||
0x0101 F2
|
||||
0x0102 F3
|
||||
0x0103 F4
|
||||
0x0104 F5
|
||||
0x0105 F6
|
||||
0x0106 F7
|
||||
0x0107 F8
|
||||
0x0108 F9
|
||||
0x0109 F10
|
||||
0x010a F11
|
||||
0x010b F12
|
||||
0x010c F13
|
||||
0x010d F14
|
||||
0x010e F15
|
||||
0x010f F16
|
||||
0x0110 F17
|
||||
0x0111 F18
|
||||
0x0112 F19
|
||||
0x0113 F20
|
||||
0x0114 Find
|
||||
0x0115 Insert
|
||||
0x0116 Remove
|
||||
0x0117 Select
|
||||
0x0118 Prior
|
||||
0x0119 Next
|
||||
0x011a Macro
|
||||
0x011b Help
|
||||
0x011c Do
|
||||
0x011d Pause
|
||||
0x011e F21
|
||||
0x011f F22
|
||||
0x0120 F23
|
||||
0x0121 F24
|
||||
0x0122 F25
|
||||
0x0123 F26
|
||||
0x0124 F27
|
||||
0x0125 F28
|
||||
0x0126 F29
|
||||
0x0127 F30
|
||||
0x0128 F31
|
||||
0x0129 F32
|
||||
0x012a F33
|
||||
0x012b F34
|
||||
0x012c F35
|
||||
0x012d F36
|
||||
0x012e F37
|
||||
0x012f F38
|
||||
0x0130 F39
|
||||
0x0131 F40
|
||||
0x0132 F41
|
||||
0x0133 F42
|
||||
0x0134 F43
|
||||
0x0135 F44
|
||||
0x0136 F45
|
||||
0x0137 F46
|
||||
0x0138 F47
|
||||
0x0139 F48
|
||||
0x013a F49
|
||||
0x013b F50
|
||||
0x013c F51
|
||||
0x013d F52
|
||||
0x013e F53
|
||||
0x013f F54
|
||||
0x0140 F55
|
||||
0x0141 F56
|
||||
0x0142 F57
|
||||
0x0143 F58
|
||||
0x0144 F59
|
||||
0x0145 F60
|
||||
0x0146 F61
|
||||
0x0147 F62
|
||||
0x0148 F63
|
||||
0x0149 F64
|
||||
0x014a F65
|
||||
0x014b F66
|
||||
0x014c F67
|
||||
0x014d F68
|
||||
0x014e F69
|
||||
0x014f F70
|
||||
0x0150 F71
|
||||
0x0151 F72
|
||||
0x0152 F73
|
||||
0x0153 F74
|
||||
0x0154 F75
|
||||
0x0155 F76
|
||||
0x0156 F77
|
||||
0x0157 F78
|
||||
0x0158 F79
|
||||
0x0159 F80
|
||||
0x015a F81
|
||||
0x015b F82
|
||||
0x015c F83
|
||||
0x015d F84
|
||||
0x015e F85
|
||||
0x015f F86
|
||||
0x0160 F87
|
||||
0x0161 F88
|
||||
0x0162 F89
|
||||
0x0163 F90
|
||||
0x0164 F91
|
||||
0x0165 F92
|
||||
0x0166 F93
|
||||
0x0167 F94
|
||||
0x0168 F95
|
||||
0x0169 F96
|
||||
0x016a F97
|
||||
0x016b F98
|
||||
0x016c F99
|
||||
0x016d F100
|
||||
0x016e F101
|
||||
0x016f F102
|
||||
0x0170 F103
|
||||
0x0171 F104
|
||||
0x0172 F105
|
||||
0x0173 F106
|
||||
0x0174 F107
|
||||
0x0175 F108
|
||||
0x0176 F109
|
||||
0x0177 F110
|
||||
0x0178 F111
|
||||
0x0179 F112
|
||||
0x017a F113
|
||||
0x017b F114
|
||||
0x017c F115
|
||||
0x017d F116
|
||||
0x017e F117
|
||||
0x017f F118
|
||||
0x0180 F119
|
||||
0x0181 F120
|
||||
0x0182 F121
|
||||
0x0183 F122
|
||||
0x0184 F123
|
||||
0x0185 F124
|
||||
0x0186 F125
|
||||
0x0187 F126
|
||||
0x0188 F127
|
||||
0x0189 F128
|
||||
0x018a F129
|
||||
0x018b F130
|
||||
0x018c F131
|
||||
0x018d F132
|
||||
0x018e F133
|
||||
0x018f F134
|
||||
0x0190 F135
|
||||
0x0191 F136
|
||||
0x0192 F137
|
||||
0x0193 F138
|
||||
0x0194 F139
|
||||
0x0195 F140
|
||||
0x0196 F141
|
||||
0x0197 F142
|
||||
0x0198 F143
|
||||
0x0199 F144
|
||||
0x019a F145
|
||||
0x019b F146
|
||||
0x019c F147
|
||||
0x019d F148
|
||||
0x019e F149
|
||||
0x019f F150
|
||||
0x01a0 F151
|
||||
0x01a1 F152
|
||||
0x01a2 F153
|
||||
0x01a3 F154
|
||||
0x01a4 F155
|
||||
0x01a5 F156
|
||||
0x01a6 F157
|
||||
0x01a7 F158
|
||||
0x01a8 F159
|
||||
0x01a9 F160
|
||||
0x01aa F161
|
||||
0x01ab F162
|
||||
0x01ac F163
|
||||
0x01ad F164
|
||||
0x01ae F165
|
||||
0x01af F166
|
||||
0x01b0 F167
|
||||
0x01b1 F168
|
||||
0x01b2 F169
|
||||
0x01b3 F170
|
||||
0x01b4 F171
|
||||
0x01b5 F172
|
||||
0x01b6 F173
|
||||
0x01b7 F174
|
||||
0x01b8 F175
|
||||
0x01b9 F176
|
||||
0x01ba F177
|
||||
0x01bb F178
|
||||
0x01bc F179
|
||||
0x01bd F180
|
||||
0x01be F181
|
||||
0x01bf F182
|
||||
0x01c0 F183
|
||||
0x01c1 F184
|
||||
0x01c2 F185
|
||||
0x01c3 F186
|
||||
0x01c4 F187
|
||||
0x01c5 F188
|
||||
0x01c6 F189
|
||||
0x01c7 F190
|
||||
0x01c8 F191
|
||||
0x01c9 F192
|
||||
0x01ca F193
|
||||
0x01cb F194
|
||||
0x01cc F195
|
||||
0x01cd F196
|
||||
0x01ce F197
|
||||
0x01cf F198
|
||||
0x01d0 F199
|
||||
0x01d1 F200
|
||||
0x01d2 F201
|
||||
0x01d3 F202
|
||||
0x01d4 F203
|
||||
0x01d5 F204
|
||||
0x01d6 F205
|
||||
0x01d7 F206
|
||||
0x01d8 F207
|
||||
0x01d9 F208
|
||||
0x01da F209
|
||||
0x01db F210
|
||||
0x01dc F211
|
||||
0x01dd F212
|
||||
0x01de F213
|
||||
0x01df F214
|
||||
0x01e0 F215
|
||||
0x01e1 F216
|
||||
0x01e2 F217
|
||||
0x01e3 F218
|
||||
0x01e4 F219
|
||||
0x01e5 F220
|
||||
0x01e6 F221
|
||||
0x01e7 F222
|
||||
0x01e8 F223
|
||||
0x01e9 F224
|
||||
0x01ea F225
|
||||
0x01eb F226
|
||||
0x01ec F227
|
||||
0x01ed F228
|
||||
0x01ee F229
|
||||
0x01ef F230
|
||||
0x01f0 F231
|
||||
0x01f1 F232
|
||||
0x01f2 F233
|
||||
0x01f3 F234
|
||||
0x01f4 F235
|
||||
0x01f5 F236
|
||||
0x01f6 F237
|
||||
0x01f7 F238
|
||||
0x01f8 F239
|
||||
0x01f9 F240
|
||||
0x01fa F241
|
||||
0x01fb F242
|
||||
0x01fc F243
|
||||
0x01fd F244
|
||||
0x01fe F245
|
||||
0x01ff F246
|
||||
0x0200 VoidSymbol
|
||||
0x0201 Return
|
||||
0x0202 Show_Registers
|
||||
0x0203 Show_Memory
|
||||
0x0204 Show_State
|
||||
0x0205 Break
|
||||
0x0206 Last_Console
|
||||
0x0207 Caps_Lock
|
||||
0x0208 Num_Lock
|
||||
0x0209 Scroll_Lock
|
||||
0x020a Scroll_Forward
|
||||
0x020b Scroll_Backward
|
||||
0x020c Boot
|
||||
0x020d Caps_On
|
||||
0x020e Compose
|
||||
0x020f SAK
|
||||
0x0210 Decr_Console
|
||||
0x0211 Incr_Console
|
||||
0x0212 KeyboardSignal
|
||||
0x0213 Bare_Num_Lock
|
||||
0x0300 KP_0
|
||||
0x0301 KP_1
|
||||
0x0302 KP_2
|
||||
0x0303 KP_3
|
||||
0x0304 KP_4
|
||||
0x0305 KP_5
|
||||
0x0306 KP_6
|
||||
0x0307 KP_7
|
||||
0x0308 KP_8
|
||||
0x0309 KP_9
|
||||
0x030a KP_Add
|
||||
0x030b KP_Subtract
|
||||
0x030c KP_Multiply
|
||||
0x030d KP_Divide
|
||||
0x030e KP_Enter
|
||||
0x030f KP_Comma
|
||||
0x0310 KP_Period
|
||||
0x0311 KP_MinPlus
|
||||
0x0400 dead_grave
|
||||
0x0401 dead_acute
|
||||
0x0402 dead_circumflex
|
||||
0x0403 dead_tilde
|
||||
0x0404 dead_diaeresis
|
||||
0x0405 dead_cedilla
|
||||
0x0406 dead_macron
|
||||
0x0407 dead_kbreve
|
||||
0x0408 dead_abovedot
|
||||
0x0409 dead_abovering
|
||||
0x040a dead_kdoubleacute
|
||||
0x040b dead_kcaron
|
||||
0x040c dead_kogonek
|
||||
0x040d dead_iota
|
||||
0x040e dead_voiced_sound
|
||||
0x040f dead_semivoiced_sound
|
||||
0x0410 dead_belowdot
|
||||
0x0411 dead_hook
|
||||
0x0412 dead_horn
|
||||
0x0413 dead_stroke
|
||||
0x0414 dead_abovecomma
|
||||
0x0415 dead_abovereversedcomma
|
||||
0x0416 dead_doublegrave
|
||||
0x0417 dead_invertedbreve
|
||||
0x0418 dead_belowcomma
|
||||
0x0419 dead_currency
|
||||
0x041a dead_greek
|
||||
0x0500 Console_1
|
||||
0x0501 Console_2
|
||||
0x0502 Console_3
|
||||
0x0503 Console_4
|
||||
0x0504 Console_5
|
||||
0x0505 Console_6
|
||||
0x0506 Console_7
|
||||
0x0507 Console_8
|
||||
0x0508 Console_9
|
||||
0x0509 Console_10
|
||||
0x050a Console_11
|
||||
0x050b Console_12
|
||||
0x050c Console_13
|
||||
0x050d Console_14
|
||||
0x050e Console_15
|
||||
0x050f Console_16
|
||||
0x0510 Console_17
|
||||
0x0511 Console_18
|
||||
0x0512 Console_19
|
||||
0x0513 Console_20
|
||||
0x0514 Console_21
|
||||
0x0515 Console_22
|
||||
0x0516 Console_23
|
||||
0x0517 Console_24
|
||||
0x0518 Console_25
|
||||
0x0519 Console_26
|
||||
0x051a Console_27
|
||||
0x051b Console_28
|
||||
0x051c Console_29
|
||||
0x051d Console_30
|
||||
0x051e Console_31
|
||||
0x051f Console_32
|
||||
0x0520 Console_33
|
||||
0x0521 Console_34
|
||||
0x0522 Console_35
|
||||
0x0523 Console_36
|
||||
0x0524 Console_37
|
||||
0x0525 Console_38
|
||||
0x0526 Console_39
|
||||
0x0527 Console_40
|
||||
0x0528 Console_41
|
||||
0x0529 Console_42
|
||||
0x052a Console_43
|
||||
0x052b Console_44
|
||||
0x052c Console_45
|
||||
0x052d Console_46
|
||||
0x052e Console_47
|
||||
0x052f Console_48
|
||||
0x0530 Console_49
|
||||
0x0531 Console_50
|
||||
0x0532 Console_51
|
||||
0x0533 Console_52
|
||||
0x0534 Console_53
|
||||
0x0535 Console_54
|
||||
0x0536 Console_55
|
||||
0x0537 Console_56
|
||||
0x0538 Console_57
|
||||
0x0539 Console_58
|
||||
0x053a Console_59
|
||||
0x053b Console_60
|
||||
0x053c Console_61
|
||||
0x053d Console_62
|
||||
0x053e Console_63
|
||||
0x0600 Down
|
||||
0x0601 Left
|
||||
0x0602 Right
|
||||
0x0603 Up
|
||||
0x0700 Shift
|
||||
0x0701 AltGr
|
||||
0x0702 Control
|
||||
0x0703 Alt
|
||||
0x0704 ShiftL
|
||||
0x0705 ShiftR
|
||||
0x0706 CtrlL
|
||||
0x0707 CtrlR
|
||||
0x0708 CapsShift
|
||||
0x0800 Meta_nul
|
||||
0x0801 Meta_Control_a
|
||||
0x0802 Meta_Control_b
|
||||
0x0803 Meta_Control_c
|
||||
0x0804 Meta_Control_d
|
||||
0x0805 Meta_Control_e
|
||||
0x0806 Meta_Control_f
|
||||
0x0807 Meta_Control_g
|
||||
0x0808 Meta_BackSpace
|
||||
0x0809 Meta_Tab
|
||||
0x080a Meta_Linefeed
|
||||
0x080b Meta_Control_k
|
||||
0x080c Meta_Control_l
|
||||
0x080d Meta_Control_m
|
||||
0x080e Meta_Control_n
|
||||
0x080f Meta_Control_o
|
||||
0x0810 Meta_Control_p
|
||||
0x0811 Meta_Control_q
|
||||
0x0812 Meta_Control_r
|
||||
0x0813 Meta_Control_s
|
||||
0x0814 Meta_Control_t
|
||||
0x0815 Meta_Control_u
|
||||
0x0816 Meta_Control_v
|
||||
0x0817 Meta_Control_w
|
||||
0x0818 Meta_Control_x
|
||||
0x0819 Meta_Control_y
|
||||
0x081a Meta_Control_z
|
||||
0x081b Meta_Escape
|
||||
0x081c Meta_Control_backslash
|
||||
0x081d Meta_Control_bracketright
|
||||
0x081e Meta_Control_asciicircum
|
||||
0x081f Meta_Control_underscore
|
||||
0x0820 Meta_space
|
||||
0x0821 Meta_exclam
|
||||
0x0822 Meta_quotedbl
|
||||
0x0823 Meta_numbersign
|
||||
0x0824 Meta_dollar
|
||||
0x0825 Meta_percent
|
||||
0x0826 Meta_ampersand
|
||||
0x0827 Meta_apostrophe
|
||||
0x0828 Meta_parenleft
|
||||
0x0829 Meta_parenright
|
||||
0x082a Meta_asterisk
|
||||
0x082b Meta_plus
|
||||
0x082c Meta_comma
|
||||
0x082d Meta_minus
|
||||
0x082e Meta_period
|
||||
0x082f Meta_slash
|
||||
0x0830 Meta_zero
|
||||
0x0831 Meta_one
|
||||
0x0832 Meta_two
|
||||
0x0833 Meta_three
|
||||
0x0834 Meta_four
|
||||
0x0835 Meta_five
|
||||
0x0836 Meta_six
|
||||
0x0837 Meta_seven
|
||||
0x0838 Meta_eight
|
||||
0x0839 Meta_nine
|
||||
0x083a Meta_colon
|
||||
0x083b Meta_semicolon
|
||||
0x083c Meta_less
|
||||
0x083d Meta_equal
|
||||
0x083e Meta_greater
|
||||
0x083f Meta_question
|
||||
0x0840 Meta_at
|
||||
0x0841 Meta_A
|
||||
0x0842 Meta_B
|
||||
0x0843 Meta_C
|
||||
0x0844 Meta_D
|
||||
0x0845 Meta_E
|
||||
0x0846 Meta_F
|
||||
0x0847 Meta_G
|
||||
0x0848 Meta_H
|
||||
0x0849 Meta_I
|
||||
0x084a Meta_J
|
||||
0x084b Meta_K
|
||||
0x084c Meta_L
|
||||
0x084d Meta_M
|
||||
0x084e Meta_N
|
||||
0x084f Meta_O
|
||||
0x0850 Meta_P
|
||||
0x0851 Meta_Q
|
||||
0x0852 Meta_R
|
||||
0x0853 Meta_S
|
||||
0x0854 Meta_T
|
||||
0x0855 Meta_U
|
||||
0x0856 Meta_V
|
||||
0x0857 Meta_W
|
||||
0x0858 Meta_X
|
||||
0x0859 Meta_Y
|
||||
0x085a Meta_Z
|
||||
0x085b Meta_bracketleft
|
||||
0x085c Meta_backslash
|
||||
0x085d Meta_bracketright
|
||||
0x085e Meta_asciicircum
|
||||
0x085f Meta_underscore
|
||||
0x0860 Meta_grave
|
||||
0x0861 Meta_a
|
||||
0x0862 Meta_b
|
||||
0x0863 Meta_c
|
||||
0x0864 Meta_d
|
||||
0x0865 Meta_e
|
||||
0x0866 Meta_f
|
||||
0x0867 Meta_g
|
||||
0x0868 Meta_h
|
||||
0x0869 Meta_i
|
||||
0x086a Meta_j
|
||||
0x086b Meta_k
|
||||
0x086c Meta_l
|
||||
0x086d Meta_m
|
||||
0x086e Meta_n
|
||||
0x086f Meta_o
|
||||
0x0870 Meta_p
|
||||
0x0871 Meta_q
|
||||
0x0872 Meta_r
|
||||
0x0873 Meta_s
|
||||
0x0874 Meta_t
|
||||
0x0875 Meta_u
|
||||
0x0876 Meta_v
|
||||
0x0877 Meta_w
|
||||
0x0878 Meta_x
|
||||
0x0879 Meta_y
|
||||
0x087a Meta_z
|
||||
0x087b Meta_braceleft
|
||||
0x087c Meta_bar
|
||||
0x087d Meta_braceright
|
||||
0x087e Meta_asciitilde
|
||||
0x087f Meta_Delete
|
||||
0x0900 Ascii_0
|
||||
0x0901 Ascii_1
|
||||
0x0902 Ascii_2
|
||||
0x0903 Ascii_3
|
||||
0x0904 Ascii_4
|
||||
0x0905 Ascii_5
|
||||
0x0906 Ascii_6
|
||||
0x0907 Ascii_7
|
||||
0x0908 Ascii_8
|
||||
0x0909 Ascii_9
|
||||
0x090a Hex_0
|
||||
0x090b Hex_1
|
||||
0x090c Hex_2
|
||||
0x090d Hex_3
|
||||
0x090e Hex_4
|
||||
0x090f Hex_5
|
||||
0x0910 Hex_6
|
||||
0x0911 Hex_7
|
||||
0x0912 Hex_8
|
||||
0x0913 Hex_9
|
||||
0x0914 Hex_A
|
||||
0x0915 Hex_B
|
||||
0x0916 Hex_C
|
||||
0x0917 Hex_D
|
||||
0x0918 Hex_E
|
||||
0x0919 Hex_F
|
||||
0x0a00 Shift_Lock
|
||||
0x0a01 AltGr_Lock
|
||||
0x0a02 Control_Lock
|
||||
0x0a03 Alt_Lock
|
||||
0x0a04 ShiftL_Lock
|
||||
0x0a05 ShiftR_Lock
|
||||
0x0a06 CtrlL_Lock
|
||||
0x0a07 CtrlR_Lock
|
||||
0x0a08 CapsShift_Lock
|
||||
0x0c00 SShift
|
||||
0x0c01 SAltGr
|
||||
0x0c02 SControl
|
||||
0x0c03 SAlt
|
||||
0x0c04 SShiftL
|
||||
0x0c05 SShiftR
|
||||
0x0c06 SCtrlL
|
||||
0x0c07 SCtrlR
|
||||
0x0c08 SCapsShift
|
||||
0x0e00 Brl_blank
|
||||
0x0e01 Brl_dot1
|
||||
0x0e02 Brl_dot2
|
||||
0x0e03 Brl_dot3
|
||||
0x0e04 Brl_dot4
|
||||
0x0e05 Brl_dot5
|
||||
0x0e06 Brl_dot6
|
||||
0x0e07 Brl_dot7
|
||||
0x0e08 Brl_dot8
|
||||
0x0e09 Brl_dot9
|
||||
0x0e0a Brl_dot10
|
||||
|
||||
The following synonyms are recognized:
|
||||
|
||||
Control_h for BackSpace
|
||||
Control_i for Tab
|
||||
Control_j for Linefeed
|
||||
Home for Find
|
||||
End for Select
|
||||
PageUp for Prior
|
||||
PageDown for Next
|
||||
multiplication for multiply
|
||||
pound for sterling
|
||||
pilcrow for paragraph
|
||||
Oslash for Ooblique
|
||||
Shift_L for ShiftL
|
||||
Shift_R for ShiftR
|
||||
Control_L for CtrlL
|
||||
Control_R for CtrlR
|
||||
AltL for Alt
|
||||
AltR for AltGr
|
||||
Alt_L for Alt
|
||||
Alt_R for AltGr
|
||||
AltGr_L for Alt
|
||||
AltGr_R for AltGr
|
||||
AltLLock for Alt_Lock
|
||||
AltRLock for AltGr_Lock
|
||||
SCtrl for SControl
|
||||
Spawn_Console for KeyboardSignal
|
||||
Uncaps_Shift for CapsShift
|
||||
lambda for lamda
|
||||
Lambda for Lamda
|
||||
xi for ksi
|
||||
Xi for Ksi
|
||||
chi for khi
|
||||
Chi for Khi
|
||||
tilde for asciitilde
|
||||
circumflex for asciicircum
|
||||
dead_ogonek for dead_cedilla
|
||||
dead_caron for dead_circumflex
|
||||
dead_breve for dead_tilde
|
||||
dead_doubleacute for dead_tilde
|
||||
Idotabove for Iabovedot
|
||||
dotlessi for idotless
|
||||
no-break_space for nobreakspace
|
||||
paragraph_sign for section
|
||||
soft_hyphen for hyphen
|
||||
bielorussian_cyrillic_capital_letter_i for ukrainian_cyrillic_capital_letter_i
|
||||
cyrillic_capital_letter_kha for cyrillic_capital_letter_ha
|
||||
cyrillic_capital_letter_ge for cyrillic_capital_letter_ghe
|
||||
cyrillic_capital_letter_ia for cyrillic_capital_letter_ya
|
||||
cyrillic_capital_letter_iu for cyrillic_capital_letter_yu
|
||||
cyrillic_capital_letter_yeri for cyrillic_capital_letter_yeru
|
||||
cyrillic_capital_letter_reversed_e for cyrillic_capital_letter_e
|
||||
cyrillic_capital_letter_ii for cyrillic_capital_letter_i
|
||||
cyrillic_capital_letter_short_ii for cyrillic_capital_letter_short_i
|
||||
bielorussian_cyrillic_small_letter_i for ukrainian_cyrillic_small_letter_i
|
||||
cyrillic_small_letter_kha for cyrillic_small_letter_ha
|
||||
cyrillic_small_letter_ge for cyrillic_small_letter_ghe
|
||||
cyrillic_small_letter_ia for cyrillic_small_letter_ya
|
||||
cyrillic_small_letter_iu for cyrillic_small_letter_yu
|
||||
cyrillic_small_letter_yeri for cyrillic_small_letter_yeru
|
||||
cyrillic_small_letter_reversed_e for cyrillic_small_letter_e
|
||||
cyrillic_small_letter_ii for cyrillic_small_letter_i
|
||||
cyrillic_small_letter_short_ii for cyrillic_small_letter_short_i
|
||||
ukrainian_cyrillic_small_letter_ghe_with_upturn for cyrillic_small_letter_ghe_with_upturn
|
||||
ukrainian_cyrillic_capital_letter_ghe_with_upturn for cyrillic_capital_letter_ghe_with_upturn
|
||||
rightanglequote for guillemotright
|
||||
|
||||
Recognized modifier names and their column numbers:
|
||||
shift 1
|
||||
altgr 2
|
||||
control 4
|
||||
alt 8
|
||||
shiftl 16
|
||||
shiftr 32
|
||||
ctrll 64
|
||||
ctrlr 128
|
||||
capsshift 256
|
||||
|
||||
Available charsets: iso-8859-{2,3,4,5,7,8,9,10,15},koi8-{r,u},mazovia,cp-1250,tis-620,iso-10646-18,iso-ir-197,iso-ir-209
|
||||
68
tests/data/keymap7-compose-as-usual.txt
Normal file
68
tests/data/keymap7-compose-as-usual.txt
Normal file
@ -0,0 +1,68 @@
|
||||
compose '`' 'A' to Agrave
|
||||
compose '`' 'a' to agrave
|
||||
compose '\'' 'A' to Aacute
|
||||
compose '\'' 'a' to aacute
|
||||
compose '^' 'A' to Acircumflex
|
||||
compose '^' 'a' to acircumflex
|
||||
compose '~' 'A' to Atilde
|
||||
compose '~' 'a' to atilde
|
||||
compose '"' 'A' to Adiaeresis
|
||||
compose '"' 'a' to adiaeresis
|
||||
compose 'O' 'A' to Aring
|
||||
compose 'o' 'a' to aring
|
||||
compose '0' 'A' to Aring
|
||||
compose '0' 'a' to aring
|
||||
compose 'A' 'A' to Aring
|
||||
compose 'a' 'a' to aring
|
||||
compose 'A' 'E' to AE
|
||||
compose 'a' 'e' to ae
|
||||
compose ',' 'C' to Ccedilla
|
||||
compose ',' 'c' to ccedilla
|
||||
compose '`' 'E' to Egrave
|
||||
compose '`' 'e' to egrave
|
||||
compose '\'' 'E' to Eacute
|
||||
compose '\'' 'e' to eacute
|
||||
compose '^' 'E' to Ecircumflex
|
||||
compose '^' 'e' to ecircumflex
|
||||
compose '"' 'E' to Ediaeresis
|
||||
compose '"' 'e' to ediaeresis
|
||||
compose '`' 'I' to Igrave
|
||||
compose '`' 'i' to igrave
|
||||
compose '\'' 'I' to Iacute
|
||||
compose '\'' 'i' to iacute
|
||||
compose '^' 'I' to Icircumflex
|
||||
compose '^' 'i' to icircumflex
|
||||
compose '"' 'I' to Idiaeresis
|
||||
compose '"' 'i' to idiaeresis
|
||||
compose '-' 'D' to ETH
|
||||
compose '-' 'd' to eth
|
||||
compose '~' 'N' to Ntilde
|
||||
compose '~' 'n' to ntilde
|
||||
compose '`' 'O' to Ograve
|
||||
compose '`' 'o' to ograve
|
||||
compose '\'' 'O' to Oacute
|
||||
compose '\'' 'o' to oacute
|
||||
compose '^' 'O' to Ocircumflex
|
||||
compose '^' 'o' to ocircumflex
|
||||
compose '~' 'O' to Otilde
|
||||
compose '~' 'o' to otilde
|
||||
compose '"' 'O' to Odiaeresis
|
||||
compose '"' 'o' to odiaeresis
|
||||
compose '/' 'O' to Ooblique
|
||||
compose '/' 'o' to oslash
|
||||
compose '`' 'U' to Ugrave
|
||||
compose '`' 'u' to ugrave
|
||||
compose '\'' 'U' to Uacute
|
||||
compose '\'' 'u' to uacute
|
||||
compose '^' 'U' to Ucircumflex
|
||||
compose '^' 'u' to ucircumflex
|
||||
compose '"' 'U' to Udiaeresis
|
||||
compose '"' 'u' to udiaeresis
|
||||
compose '\'' 'Y' to Yacute
|
||||
compose '\'' 'y' to yacute
|
||||
compose 'T' 'H' to THORN
|
||||
compose 't' 'h' to thorn
|
||||
compose 's' 's' to ssharp
|
||||
compose '"' 'y' to ydiaeresis
|
||||
compose 's' 'z' to ssharp
|
||||
compose 'i' 'j' to ydiaeresis
|
||||
3
tests/data/libcommon/footer.txt
Normal file
3
tests/data/libcommon/footer.txt
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
Report bugs to authors.
|
||||
|
||||
5
tests/data/libcommon/options1.txt
Normal file
5
tests/data/libcommon/options1.txt
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
Options:
|
||||
-C, --console=DEV the console device to be used.
|
||||
-V, --version print version number.
|
||||
-h, --help print this usage message.
|
||||
1
tests/data/libkeymap/keymap7.map
Normal file
1
tests/data/libkeymap/keymap7.map
Normal file
@ -0,0 +1 @@
|
||||
compose as usual
|
||||
22
tests/libcommon.at
Normal file
22
tests/libcommon.at
Normal file
@ -0,0 +1,22 @@
|
||||
AT_BANNER([libcommon unit tests])
|
||||
|
||||
AT_SETUP([test options output])
|
||||
AT_KEYWORDS([libcommon unittest])
|
||||
cp -f -- \
|
||||
"$abs_srcdir/data/libcommon/options1.txt" \
|
||||
experr
|
||||
UNITTEST_MEMCHECK([$abs_builddir/libcommon/libcommon-test01], [0], [], [experr])
|
||||
AT_CLEANUP
|
||||
|
||||
AT_SETUP([test footer message])
|
||||
AT_KEYWORDS([libcommon unittest])
|
||||
cp -f -- \
|
||||
"$abs_srcdir/data/libcommon/footer.txt" \
|
||||
experr
|
||||
UNITTEST_MEMCHECK([$abs_builddir/libcommon/libcommon-test02], [0], [], [experr])
|
||||
AT_CLEANUP
|
||||
|
||||
AT_SETUP([test get console])
|
||||
AT_KEYWORDS([libcommon unittest])
|
||||
UNITTEST_MEMCHECK([$abs_builddir/libcommon/libcommon-test03])
|
||||
AT_CLEANUP
|
||||
20
tests/libcommon/Makefile.am
Normal file
20
tests/libcommon/Makefile.am
Normal file
@ -0,0 +1,20 @@
|
||||
NULL =
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
$(CODE_COVERAGE_CPPFLAGS) \
|
||||
-I$(top_srcdir)/src/include \
|
||||
-I$(top_srcdir)/src/libcommon \
|
||||
-DTESTDIR=\"$(realpath $(top_srcdir))/tests\"
|
||||
|
||||
AM_CFLAGS = $(CHECK_CFLAGS) $(CODE_COVERAGE_CFLAGS)
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/src/libcommon/libcommon.a \
|
||||
@LIBINTL@ $(CODE_COVERAGE_LIBS)
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
libcommon-test01 \
|
||||
libcommon-test02 \
|
||||
libcommon-test03 \
|
||||
$(NULL)
|
||||
|
||||
20
tests/libcommon/libcommon-test01.c
Normal file
20
tests/libcommon/libcommon-test01.c
Normal file
@ -0,0 +1,20 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "libcommon.h"
|
||||
|
||||
int main(int argc KBD_ATTR_UNUSED, char **argv KBD_ATTR_UNUSED)
|
||||
{
|
||||
const struct kbd_help opthelp[] = {
|
||||
{ "-C, --console=DEV", "the console device to be used." },
|
||||
{ "-V, --version", "print version number." },
|
||||
{ "-h, --help", "print this usage message." },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
print_options(opthelp);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
13
tests/libcommon/libcommon-test02.c
Normal file
13
tests/libcommon/libcommon-test02.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "libcommon.h"
|
||||
|
||||
int main(int argc KBD_ATTR_UNUSED, char **argv KBD_ATTR_UNUSED)
|
||||
{
|
||||
print_report_bugs();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
24
tests/libcommon/libcommon-test03.c
Normal file
24
tests/libcommon/libcommon-test03.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "libcommon.h"
|
||||
|
||||
int main(int argc KBD_ATTR_UNUSED, char **argv KBD_ATTR_UNUSED)
|
||||
{
|
||||
int console;
|
||||
char *name;
|
||||
|
||||
if (!isatty(0))
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
console = getfd(NULL);
|
||||
name = ttyname(console);
|
||||
close(console);
|
||||
|
||||
console = getfd(name);
|
||||
close(console);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@ -64,3 +64,8 @@ AT_SETUP([test 13])
|
||||
AT_KEYWORDS([libkbdfile unittest])
|
||||
UNITTEST_MEMCHECK([$abs_builddir/libkbdfile/libkbdfile-test13])
|
||||
AT_CLEANUP
|
||||
|
||||
AT_SETUP([test 14])
|
||||
AT_KEYWORDS([libkbdfile unittest])
|
||||
UNITTEST_MEMCHECK([$abs_builddir/libkbdfile/libkbdfile-test14])
|
||||
AT_CLEANUP
|
||||
|
||||
@ -27,4 +27,5 @@ noinst_PROGRAMS = \
|
||||
libkbdfile-test11 \
|
||||
libkbdfile-test12 \
|
||||
libkbdfile-test13 \
|
||||
libkbdfile-test14 \
|
||||
$(NULL)
|
||||
|
||||
43
tests/libkbdfile/libkbdfile-test14.c
Normal file
43
tests/libkbdfile/libkbdfile-test14.c
Normal file
@ -0,0 +1,43 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <err.h>
|
||||
|
||||
#include <kbdfile.h>
|
||||
#include "libcommon.h"
|
||||
|
||||
#define __stringify_1(x...) #x
|
||||
#define __stringify(x...) __stringify_1(x)
|
||||
|
||||
#define CHECK_RETCODE(funcname, expcode, args...) \
|
||||
do { \
|
||||
if (funcname(args) != expcode) \
|
||||
errx(EXIT_FAILURE, __stringify(funcname) ": unexpected return code"); \
|
||||
} while(0)
|
||||
|
||||
int
|
||||
main(int argc KBD_ATTR_UNUSED, char **argv KBD_ATTR_UNUSED)
|
||||
{
|
||||
struct kbdfile_ctx *ctx = kbdfile_context_new();
|
||||
|
||||
CHECK_RETCODE(kbdfile_get_log_fn, NULL, NULL);
|
||||
CHECK_RETCODE(kbdfile_set_log_fn, -1, NULL, NULL, NULL);
|
||||
CHECK_RETCODE(kbdfile_get_log_data, NULL, NULL);
|
||||
CHECK_RETCODE(kbdfile_set_log_data, -1, NULL, NULL);
|
||||
CHECK_RETCODE(kbdfile_get_log_priority, -1, NULL);
|
||||
CHECK_RETCODE(kbdfile_set_log_priority, -1, NULL, 0);
|
||||
CHECK_RETCODE(kbdfile_context_free, NULL, NULL);
|
||||
|
||||
CHECK_RETCODE(kbdfile_set_log_priority, 0, ctx, 123);
|
||||
CHECK_RETCODE(kbdfile_get_log_priority, 123, ctx);
|
||||
|
||||
const char *data = "data";
|
||||
|
||||
CHECK_RETCODE(kbdfile_set_log_data, 0, ctx, data);
|
||||
CHECK_RETCODE(kbdfile_get_log_data, data, ctx);
|
||||
|
||||
CHECK_RETCODE(kbdfile_context_free, NULL, ctx);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@ -182,3 +182,19 @@ cp -f -- \
|
||||
UNITTEST_MEMCHECK([$abs_top_builddir/src/loadkeys -b "$abs_srcdir/data/keymaps/i386/qwerty/cz.map"],
|
||||
[0], [expout])
|
||||
AT_CLEANUP
|
||||
|
||||
AT_SETUP([dump summary])
|
||||
AT_KEYWORDS([libkeymap unittest])
|
||||
cp -f -- \
|
||||
"$abs_srcdir/data/keymap0-summary.txt" \
|
||||
expout
|
||||
UNITTEST_MEMCHECK([$abs_builddir/libkeymap/libkeymap-test19], [0], [expout])
|
||||
AT_CLEANUP
|
||||
|
||||
AT_SETUP([dump compose as usual])
|
||||
AT_KEYWORDS([libkeymap unittest])
|
||||
cp -f -- \
|
||||
"$abs_srcdir/data/keymap7-compose-as-usual.txt" \
|
||||
expout
|
||||
UNITTEST_MEMCHECK([$abs_builddir/libkeymap/libkeymap-test20], [0], [expout])
|
||||
AT_CLEANUP
|
||||
|
||||
@ -33,5 +33,7 @@ noinst_PROGRAMS = \
|
||||
libkeymap-test16 \
|
||||
libkeymap-test17 \
|
||||
libkeymap-test18 \
|
||||
libkeymap-test19 \
|
||||
libkeymap-test20 \
|
||||
$(NULL)
|
||||
|
||||
|
||||
@ -6,6 +6,18 @@
|
||||
#include <keymap.h>
|
||||
#include "libcommon.h"
|
||||
|
||||
static void KBD_ATTR_PRINTF(6, 0)
|
||||
log_null(void *data KBD_ATTR_UNUSED,
|
||||
int priority KBD_ATTR_UNUSED,
|
||||
const char *file KBD_ATTR_UNUSED,
|
||||
const int line KBD_ATTR_UNUSED,
|
||||
const char *fn KBD_ATTR_UNUSED,
|
||||
const char *format KBD_ATTR_UNUSED,
|
||||
va_list args KBD_ATTR_UNUSED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc KBD_ATTR_UNUSED, char **argv KBD_ATTR_UNUSED)
|
||||
{
|
||||
@ -14,6 +26,31 @@ main(int argc KBD_ATTR_UNUSED, char **argv KBD_ATTR_UNUSED)
|
||||
if ((ctx = lk_init()) == NULL)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to initialize structure by valid pointer");
|
||||
|
||||
lk_set_log_priority(ctx, LOG_ERR);
|
||||
|
||||
if (lk_get_log_priority(ctx) != LOG_ERR)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to set log priority");
|
||||
|
||||
lk_set_parser_flags(ctx, LK_FLAG_PREFER_UNICODE);
|
||||
|
||||
if (lk_get_parser_flags(ctx) != LK_FLAG_PREFER_UNICODE)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to set parser flags");
|
||||
|
||||
lk_set_keywords(ctx, LK_KEYWORD_ALTISMETA | LK_KEYWORD_CHARSET);
|
||||
|
||||
if (lk_get_keywords(ctx) != (LK_KEYWORD_ALTISMETA | LK_KEYWORD_CHARSET))
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to set keywords");
|
||||
|
||||
const char *data = "abc";
|
||||
|
||||
lk_set_log_fn(ctx, log_null, data);
|
||||
|
||||
if (lk_get_log_fn(ctx) != log_null)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to set log handler");
|
||||
|
||||
if (lk_get_log_data(ctx) != data)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to set log data");
|
||||
|
||||
lk_free(ctx);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
@ -6,6 +6,32 @@
|
||||
#include <keymap.h>
|
||||
#include "libcommon.h"
|
||||
|
||||
static void check_get_sym(struct lk_ctx *ctx, int ktyp, int index, const char *expect)
|
||||
{
|
||||
char *s = lk_get_sym(ctx, ktyp, index);
|
||||
|
||||
if (!s)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to get key symbol with index %d", index);
|
||||
|
||||
if (strcmp(s, expect))
|
||||
kbd_error(EXIT_FAILURE, 0, "Unexpected symbol at index %d", index);
|
||||
|
||||
free(s);
|
||||
}
|
||||
|
||||
static void check_code_to_ksym(struct lk_ctx *ctx, int code, const char *expect)
|
||||
{
|
||||
char *s = lk_code_to_ksym(ctx, code);
|
||||
|
||||
if (!s)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to convert code (%d) to symbol", code);
|
||||
|
||||
if (strcmp(s, expect))
|
||||
kbd_error(EXIT_FAILURE, 0, "Unexpected symbol '%s' for code %d", s, code);
|
||||
|
||||
free(s);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc KBD_ATTR_UNUSED, char **argv KBD_ATTR_UNUSED)
|
||||
{
|
||||
@ -61,6 +87,23 @@ main(int argc KBD_ATTR_UNUSED, char **argv KBD_ATTR_UNUSED)
|
||||
if (KVAL(c) != 'y')
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to get keycode 21");
|
||||
|
||||
if (lk_get_sym(ctx, 1024, 1) != NULL)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unexpected return for unknown ktype");
|
||||
|
||||
if (lk_get_sym(ctx, KT_LATIN, 512) != NULL)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unexpected return for index out of range");
|
||||
|
||||
check_get_sym(ctx, KT_LATIN, 65, "A");
|
||||
check_get_sym(ctx, KT_LATIN, 66, "B");
|
||||
check_get_sym(ctx, KT_LATIN, 67, "C");
|
||||
|
||||
check_code_to_ksym(ctx, K(KT_LATIN, 65), "A");
|
||||
check_code_to_ksym(ctx, K(KT_LATIN, 66), "B");
|
||||
check_code_to_ksym(ctx, K(KT_LATIN, 67), "C");
|
||||
|
||||
if (lk_convert_code(ctx, (int) 'A', TO_AUTO) != 'A')
|
||||
kbd_error(EXIT_FAILURE, 0, "Unexpected code after conversion of 'A'");
|
||||
|
||||
kbdfile_free(fp);
|
||||
kbdfile_context_free(kbdfile_ctx);
|
||||
lk_free(ctx);
|
||||
|
||||
@ -39,12 +39,22 @@ main(int argc KBD_ATTR_UNUSED, char **argv KBD_ATTR_UNUSED)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to parse keymap");
|
||||
|
||||
for (i = 0; i < MAX_NR_FUNC; i++) {
|
||||
if (!lk_func_exists(ctx, (int) i))
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to find func %d", i);
|
||||
|
||||
kbs.kb_func = (unsigned char) i;
|
||||
kbs.kb_string[0] = 0;
|
||||
|
||||
if (lk_get_func(ctx, &kbs) != 0)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to get func %d", i);
|
||||
}
|
||||
|
||||
if (lk_del_func(ctx, 1) != 0)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to remove func 1");
|
||||
|
||||
if (lk_func_exists(ctx, 1))
|
||||
kbd_error(EXIT_FAILURE, 0, "The func 1 still exist");
|
||||
|
||||
kbdfile_free(fp);
|
||||
kbdfile_context_free(kbdfile_ctx);
|
||||
lk_free(ctx);
|
||||
|
||||
53
tests/libkeymap/libkeymap-test19.c
Normal file
53
tests/libkeymap/libkeymap-test19.c
Normal file
@ -0,0 +1,53 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <keymap.h>
|
||||
#include "libcommon.h"
|
||||
|
||||
int
|
||||
main(int argc KBD_ATTR_UNUSED, char **argv KBD_ATTR_UNUSED)
|
||||
{
|
||||
FILE *f = NULL;
|
||||
struct kbdfile *fp = NULL;
|
||||
struct kbdfile_ctx *kbdfile_ctx;
|
||||
struct lk_ctx *ctx;
|
||||
|
||||
kbdfile_ctx = kbdfile_context_new();
|
||||
if (!kbdfile_ctx)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to create kbdfile context");
|
||||
|
||||
fp = kbdfile_new(kbdfile_ctx);
|
||||
if (!fp)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to create kbdfile");
|
||||
|
||||
ctx = lk_init();
|
||||
lk_set_log_fn(ctx, NULL, NULL);
|
||||
|
||||
kbdfile_set_pathname(fp, "keymap0.map");
|
||||
|
||||
f = fopen(TESTDIR "/data/libkeymap/keymap0.map", "r");
|
||||
if (!f)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to open: " TESTDIR "/data/libkeymap/keymap0.map: %s", strerror(errno));
|
||||
|
||||
kbdfile_set_file(fp, f);
|
||||
|
||||
if (lk_parse_keymap(ctx, fp) != 0)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to parse keymap");
|
||||
|
||||
int fake_console = fileno(f);
|
||||
|
||||
lk_dump_summary(ctx, stdout, fake_console);
|
||||
lk_dump_symbols(ctx, stdout);
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, "Available charsets: ");
|
||||
lk_list_charsets(stdout);
|
||||
|
||||
kbdfile_free(fp);
|
||||
kbdfile_context_free(kbdfile_ctx);
|
||||
lk_free(ctx);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
65
tests/libkeymap/libkeymap-test20.c
Normal file
65
tests/libkeymap/libkeymap-test20.c
Normal file
@ -0,0 +1,65 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <keymap.h>
|
||||
#include "libcommon.h"
|
||||
|
||||
int
|
||||
main(int argc KBD_ATTR_UNUSED, char **argv KBD_ATTR_UNUSED)
|
||||
{
|
||||
FILE *f = NULL;
|
||||
struct kbdfile *fp = NULL;
|
||||
struct kbdfile_ctx *kbdfile_ctx;
|
||||
struct lk_ctx *ctx;
|
||||
struct lk_kbdiacr dcr;
|
||||
|
||||
kbdfile_ctx = kbdfile_context_new();
|
||||
if (!kbdfile_ctx)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to create kbdfile context");
|
||||
|
||||
fp = kbdfile_new(kbdfile_ctx);
|
||||
if (!fp)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to create kbdfile");
|
||||
|
||||
ctx = lk_init();
|
||||
//lk_set_log_fn(ctx, NULL, NULL);
|
||||
|
||||
kbdfile_set_pathname(fp, "keymap7.map");
|
||||
|
||||
f = fopen(TESTDIR "/data/libkeymap/keymap7.map", "r");
|
||||
if (!f)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to open: " TESTDIR "/data/libkeymap/keymap7.map: %s", strerror(errno));
|
||||
|
||||
kbdfile_set_file(fp, f);
|
||||
|
||||
if (lk_parse_keymap(ctx, fp) != 0)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to parse keymap");
|
||||
|
||||
lk_dump_diacs(ctx, stdout);
|
||||
|
||||
if (!lk_diacr_exists(ctx, 1))
|
||||
kbd_warning(0, "Unable to check existance of diacr with index 1");
|
||||
|
||||
if (lk_get_diacr(ctx, 1, &dcr) != 0)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to get of diacr with index 1");
|
||||
|
||||
if (dcr.diacr != '`' || dcr.base != 'a' || dcr.result != 0340)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unexpected diacr with index 1");
|
||||
|
||||
if (lk_del_diacr(ctx, 1) != 0)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to remove diacr with index 1");
|
||||
|
||||
if (lk_diacr_exists(ctx, 1))
|
||||
kbd_warning(0, "Removed diacr with index 1 exist");
|
||||
|
||||
if (lk_add_diacr(ctx, 1, &dcr) != 0)
|
||||
kbd_error(EXIT_FAILURE, 0, "Unable to add diacr with index 1");
|
||||
|
||||
kbdfile_free(fp);
|
||||
kbdfile_context_free(kbdfile_ctx);
|
||||
lk_free(ctx);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@ -8,6 +8,8 @@ AT_INIT
|
||||
|
||||
m4_include([unittest.at])
|
||||
|
||||
m4_include([utils.at])
|
||||
m4_include([libcommon.at])
|
||||
m4_include([libkeymap.at])
|
||||
m4_include([libkbdfile.at])
|
||||
m4_include([e2e.at])
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
m4_define([UNITTEST_RUN_MEMCHECK],[[
|
||||
libtool --mode=execute -- "$abs_srcdir"/valgrind.sh memcheck $1 || exit $?;
|
||||
cat stdout ||:;
|
||||
sed '/==[0-9]\+== .*/d' stderr >&2 ||:
|
||||
]])
|
||||
|
||||
m4_define([UNITTEST_MEMCHECK],[
|
||||
|
||||
36
tests/utils.at
Normal file
36
tests/utils.at
Normal file
@ -0,0 +1,36 @@
|
||||
AT_BANNER([utilities unit tests])
|
||||
|
||||
AT_SETUP([loadkeys mutually exclusive options])
|
||||
AT_KEYWORDS([utils unittest])
|
||||
AT_SKIP_IF([ test -z "$(tty 2>/dev/null)" ])
|
||||
cat >experr <<EOF
|
||||
loadkeys: Options --unicode and --ascii are mutually exclusive.
|
||||
EOF
|
||||
AT_CHECK([$abs_top_builddir/src/loadkeys --ascii --unicode --parse /dev/null], [1], [], [experr])
|
||||
AT_CLEANUP
|
||||
|
||||
AT_SETUP([loadkeys default keymap])
|
||||
AT_KEYWORDS([utils unittest])
|
||||
AT_SKIP_IF([ test -z "$(tty 2>/dev/null)" ])
|
||||
echo > defkeymap.map
|
||||
AT_CHECK([LOADKEYS_KEYMAP_PATH="$PWD" $abs_top_builddir/src/loadkeys --default --parse])
|
||||
AT_CLEANUP
|
||||
|
||||
AT_SETUP([loadkeys prefer unicode with keymap file])
|
||||
AT_KEYWORDS([utils unittest])
|
||||
AT_SKIP_IF([ test -z "$(tty 2>/dev/null)" ])
|
||||
AT_CHECK([LOADKEYS_KEYMAP_PATH="$PWD" $abs_top_builddir/src/loadkeys -q -c -s -u --parse "$abs_srcdir/data/keymaps/i386/qwerty/cz.map"])
|
||||
AT_CLEANUP
|
||||
|
||||
AT_SETUP([loadkeys prefer unicode with stdin])
|
||||
AT_KEYWORDS([utils unittest])
|
||||
AT_SKIP_IF([ test -z "$(tty 2>/dev/null)" ])
|
||||
AT_CHECK([LOADKEYS_KEYMAP_PATH="$PWD" $abs_top_builddir/src/loadkeys -q -c -s -u --parse < "$abs_srcdir/data/keymaps/i386/qwerty/cz.map"])
|
||||
AT_CLEANUP
|
||||
|
||||
AT_SETUP([loadkeys prefer unicode with stdin file])
|
||||
AT_KEYWORDS([utils unittest])
|
||||
AT_SKIP_IF([ test -z "$(tty 2>/dev/null)" ])
|
||||
AT_CHECK([LOADKEYS_KEYMAP_PATH="$PWD" $abs_top_builddir/src/loadkeys -q -c -s -u --parse - < "$abs_srcdir/data/keymaps/i386/qwerty/cz.map"])
|
||||
AT_CLEANUP
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user