• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gansm / finalcut / #746

31 Dec 2025 10:25PM UTC coverage: 68.505% (+0.05%) from 68.454%
#746

push

travis-ci

gansm
The "FindFinalCut.cmake" file has been added to simplify the integration of FINAL CUT into CMake projects

37261 of 54392 relevant lines covered (68.5%)

226.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.6
/test/ftermfreebsd-test.cpp
1
/***********************************************************************
2
* ftermfreebsd-test.cpp - FTermFreeBSD unit tests                      *
3
*                                                                      *
4
* This file is part of the FINAL CUT widget toolkit                    *
5
*                                                                      *
6
* Copyright 2019-2025 Markus Gans                                      *
7
*                                                                      *
8
* FINAL CUT is free software; you can redistribute it and/or modify    *
9
* it under the terms of the GNU Lesser General Public License as       *
10
* published by the Free Software Foundation; either version 3 of       *
11
* the License, or (at your option) any later version.                  *
12
*                                                                      *
13
* FINAL CUT is distributed in the hope that it will be useful, but     *
14
* WITHOUT ANY WARRANTY; without even the implied warranty of           *
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
16
* GNU Lesser General Public License for more details.                  *
17
*                                                                      *
18
* You should have received a copy of the GNU Lesser General Public     *
19
* License along with this program.  If not, see                        *
20
* <http://www.gnu.org/licenses/>.                                      *
21
***********************************************************************/
22

23
#include <term.h>
24
#undef back_tab         // from term.h
25
#undef buttons          // from term.h
26
#undef carriage_return  // from term.h
27
#undef clr_bol          // from term.h
28
#undef clr_eol          // from term.h
29
#undef column_address   // from term.h
30
#undef erase_chars      // from term.h
31
#undef orig_colors      // from term.h
32
#undef orig_pair        // from term.h
33
#undef repeat_char      // from term.h
34
#undef row_address      // from term.h
35
#undef tab              // from term.h
36

37
#include <unistd.h>
38

39
#include <limits>
40
#include <string>
41

42
#include <cppunit/BriefTestProgressListener.h>
43
#include <cppunit/CompilerOutputter.h>
44
#include <cppunit/extensions/HelperMacros.h>
45
#include <cppunit/TestFixture.h>
46
#include <cppunit/TestResult.h>
47
#include <cppunit/TestResultCollector.h>
48
#include <cppunit/TestRunner.h>
49

50
#include "conemu.h"
51
#include <final/final.h>
52

53
namespace test
54
{
55

56
//----------------------------------------------------------------------
57
// class FSystemTest
58
//----------------------------------------------------------------------
59

60
class FSystemTest : public finalcut::FSystem
61
{
62
  public:
63
    // Constructor
64
    FSystemTest() = default;
2✔
65

66
    // Methods
67
    auto inPortByte (uShort) noexcept -> uChar override;
68
    void outPortByte (uChar, uShort) noexcept override;
69
    auto isTTY (int) const noexcept -> int override;
70
    auto ioctl (int, uLong, ...) noexcept -> int override;
71
    auto pipe (finalcut::PipeData&) noexcept -> int override;
72
    auto open (const char*, int, ...) noexcept -> int override;
73
    auto close (int) noexcept -> int override;
74
    auto fopen (const char*, const char*) noexcept -> FILE* override;
75
    auto fclose (FILE*) noexcept -> int override;
76
    auto fputs (const char*, FILE*) noexcept -> int override;
77
    auto putchar (int) noexcept -> int override;
78
    auto putstring (const char*, std::size_t) noexcept -> int override;
79
    auto sigaction ( int, const struct sigaction*
80
                   , struct sigaction*) noexcept -> int override;
81
    auto timer_create ( clockid_t, struct sigevent*
82
                      , timer_t* ) noexcept -> int override;
83
    auto timer_settime ( timer_t, int
84
                       , const struct itimerspec*
85
                       , struct itimerspec* ) noexcept -> int override;
86
    auto timer_delete (timer_t) noexcept -> int override;
87
    auto kqueue() noexcept -> int override;
88
    auto kevent ( int, const struct kevent*
89
                , int, struct kevent*
90
                , int, const struct timespec* ) noexcept -> int override;
91
    auto getuid() noexcept -> uid_t override;
92
    auto geteuid() noexcept -> uid_t override;
93
    auto getpwuid_r ( uid_t, struct passwd*, char*
94
                    , size_t, struct passwd** ) noexcept -> int override;
95
    auto realpath (const char*, char*) noexcept -> char* override;
96
    auto getCharacters() noexcept -> std::string&;
97
    auto getCursorType() noexcept -> int&;
98
    auto getTerminalKeymap() noexcept -> struct keymap_t&;
99

100
  private:
101
    // Data members
102
    std::string characters{};
103
    int cursor_type{0};
104
    static keymap_t keymap;
105
    static keymap_t terminal_keymap;
106
};
107

108

109
// private data member of FSystemTest
110
//----------------------------------------------------------------------
111
keymap_t FSystemTest::keymap =
112
{
113
  109,  // Number of keys
114
  {
115
    //                     map                          spcl  flag
116
    //------------------------------------------------  ----  ----
117
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0xff, 0x00 },
118
    { {0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x86, 0x1b}, 0x02, 0x00 },
119
    { {0x31, 0x21, 0x00, 0x00, 0x31, 0x21, 0x00, 0x00}, 0x33, 0x00 },
120
    { {0x32, 0x22, 0x00, 0x00, 0xb2, 0xb2, 0x00, 0x00}, 0x33, 0x00 },
121
    { {0x33, 0xa7, 0x00, 0x00, 0xb3, 0xb3, 0x00, 0x00}, 0x33, 0x00 },
122
    { {0x34, 0x24, 0x00, 0x00, 0x34, 0x24, 0x00, 0x00}, 0x33, 0x00 },
123
    { {0x35, 0x25, 0x00, 0x00, 0x35, 0x25, 0x00, 0x00}, 0x33, 0x00 },
124
    { {0x36, 0x26, 0x00, 0x00, 0x36, 0x26, 0x00, 0x00}, 0x33, 0x00 },
125
    { {0x37, 0x2f, 0x00, 0x00, 0x7b, 0x7b, 0x00, 0x00}, 0x33, 0x00 },
126
    { {0x38, 0x28, 0x1b, 0x1b, 0x5b, 0x5b, 0x1b, 0x1b}, 0x00, 0x00 },
127
    { {0x39, 0x29, 0x1d, 0x1d, 0x5d, 0x5d, 0x1d, 0x1d}, 0x00, 0x00 },
128
    { {0x30, 0x3d, 0x00, 0x00, 0x7d, 0x7d, 0x00, 0x00}, 0x33, 0x00 },
129
    { {0xdf, 0x3f, 0x1c, 0x1c, 0x5c, 0x5c, 0x1c, 0x1c}, 0x00, 0x00 },
130
    { {0x27, 0x60, 0x00, 0x00, 0xb3, 0xb4, 0x00, 0x00}, 0x33, 0x00 },
131
    { {0x08, 0x08, 0x7f, 0x7f, 0x08, 0x08, 0x7f, 0x7f}, 0x00, 0x00 },
132
    { {0x09, 0x08, 0x00, 0x00, 0x09, 0x08, 0x00, 0x00}, 0x77, 0x00 },
133
    { {0x71, 0x51, 0x11, 0x11, 0x40, 0x40, 0x00, 0x00}, 0x00, 0x01 },
134
    { {0x77, 0x57, 0x17, 0x17, 0x77, 0x57, 0x17, 0x17}, 0x00, 0x01 },
135
    { {0x65, 0x45, 0x05, 0x05, 0x20ac, 0x45, 0x05, 0x05}, 0x00, 0x01 },
136
    { {0x72, 0x52, 0x12, 0x12, 0x72, 0x52, 0x12, 0x12}, 0x00, 0x01 },
137
    { {0x74, 0x54, 0x14, 0x14, 0x74, 0x54, 0x14, 0x14}, 0x00, 0x01 },
138
    { {0x7a, 0x5a, 0x1a, 0x1a, 0x7a, 0x5a, 0x1a, 0x1a}, 0x00, 0x01 },
139
    { {0x75, 0x55, 0x15, 0x15, 0x75, 0x55, 0x15, 0x15}, 0x00, 0x01 },
140
    { {0x69, 0x49, 0x09, 0x09, 0x69, 0x49, 0x09, 0x09}, 0x00, 0x01 },
141
    { {0x6f, 0x4f, 0x0f, 0x0f, 0x6f, 0x4f, 0x0f, 0x0f}, 0x00, 0x01 },
142
    { {0x70, 0x50, 0x10, 0x10, 0x70, 0x50, 0x10, 0x10}, 0x00, 0x01 },
143
    { {0xfc, 0xdc, 0x00, 0x00, 0xfc, 0xdc, 0x1b, 0x00}, 0x31, 0x01 },
144
    { {0x2b, 0x2a, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00}, 0x33, 0x00 },
145
    { {0x0d, 0x0d, 0x0a, 0x0a, 0x0d, 0x0d, 0x0a, 0x0a}, 0x00, 0x00 },
146
    { {0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09}, 0xff, 0x00 },
147
    { {0x61, 0x41, 0x01, 0x01, 0x61, 0x41, 0x01, 0x01}, 0x00, 0x01 },
148
    { {0x73, 0x53, 0x13, 0x13, 0x73, 0x53, 0x13, 0x13}, 0x00, 0x01 },
149
    { {0x64, 0x44, 0x04, 0x04, 0x64, 0x44, 0x04, 0x04}, 0x00, 0x01 },
150
    { {0x66, 0x46, 0x06, 0x06, 0x66, 0x46, 0x06, 0x06}, 0x00, 0x01 },
151
    { {0x67, 0x47, 0x07, 0x07, 0x67, 0x47, 0x07, 0x07}, 0x00, 0x01 },
152
    { {0x68, 0x48, 0x08, 0x08, 0x68, 0x48, 0x08, 0x08}, 0x00, 0x01 },
153
    { {0x6a, 0x4a, 0x0a, 0x0a, 0x6a, 0x4a, 0x0a, 0x0a}, 0x00, 0x01 },
154
    { {0x6b, 0x4b, 0x0b, 0x0b, 0x6b, 0x4b, 0x0b, 0x0b}, 0x00, 0x01 },
155
    { {0x6c, 0x4c, 0x0c, 0x0c, 0x6c, 0x4c, 0x0c, 0x0c}, 0x00, 0x01 },
156
    { {0xf6, 0xd6, 0x00, 0x00, 0xf6, 0xd6, 0x00, 0x00}, 0x33, 0x01 },
157
    { {0xe4, 0xc4, 0x00, 0x00, 0xe4, 0xc4, 0x00, 0x00}, 0x33, 0x01 },
158
    { {0x5e, 0xb0, 0x1e, 0x1e, 0x5e, 0xb0, 0x1e, 0x1e}, 0x00, 0x00 },
159
    { {0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}, 0xff, 0x00 },
160
    { {0x23, 0x27, 0x00, 0x00, 0x23, 0x27, 0x00, 0x00}, 0x33, 0x00 },
161
    { {0x79, 0x59, 0x19, 0x19, 0x79, 0x59, 0x19, 0x19}, 0x00, 0x01 },
162
    { {0x78, 0x58, 0x18, 0x18, 0x78, 0x58, 0x18, 0x18}, 0x00, 0x01 },
163
    { {0x63, 0x43, 0x03, 0x03, 0xa2, 0x43, 0x03, 0x03}, 0x00, 0x01 },
164
    { {0x76, 0x56, 0x16, 0x16, 0x76, 0x56, 0x16, 0x16}, 0x00, 0x01 },
165
    { {0x62, 0x42, 0x02, 0x02, 0x62, 0x42, 0x02, 0x02}, 0x00, 0x01 },
166
    { {0x6e, 0x4e, 0x0e, 0x0e, 0x6e, 0x4e, 0x0e, 0x0e}, 0x00, 0x01 },
167
    { {0x6d, 0x4d, 0x0d, 0x0d, 0xb5, 0xb5, 0x0d, 0x0d}, 0x00, 0x01 },
168
    { {0x2c, 0x3b, 0x00, 0x00, 0x2c, 0x3b, 0x00, 0x00}, 0x33, 0x00 },
169
    { {0x2e, 0x3a, 0x00, 0x00, 0x2e, 0x3a, 0x00, 0x00}, 0x33, 0x00 },
170
    { {0x2d, 0x5f, 0x1f, 0x1f, 0x2d, 0x5f, 0x1f, 0x1f}, 0x00, 0x00 },
171
    { {0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}, 0xff, 0x00 },
172
    { {0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a}, 0x00, 0x00 },
173
    { {0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07}, 0xff, 0x00 },
174
    { {0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x87, 0x20}, 0x02, 0x00 },
175
    { {0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04}, 0xff, 0x00 },
176
    { {0x1b, 0x27, 0x33, 0x3f, 0x0b, 0x15, 0x0b, 0x15}, 0xff, 0x00 },
177
    { {0x1c, 0x28, 0x34, 0x40, 0x0c, 0x16, 0x0c, 0x16}, 0xff, 0x00 },
178
    { {0x1d, 0x29, 0x35, 0x41, 0x0d, 0x17, 0x0d, 0x17}, 0xff, 0x00 },
179
    { {0x1e, 0x2a, 0x36, 0x42, 0x0e, 0x18, 0x0e, 0x18}, 0xff, 0x00 },
180
    { {0x1f, 0x2b, 0x37, 0x43, 0x0f, 0x19, 0x0f, 0x19}, 0xff, 0x00 },
181
    { {0x20, 0x2c, 0x38, 0x44, 0x10, 0x1a, 0x10, 0x1a}, 0xff, 0x00 },
182
    { {0x21, 0x2d, 0x39, 0x45, 0x11, 0x11, 0x11, 0x11}, 0xff, 0x00 },
183
    { {0x22, 0x2e, 0x3a, 0x46, 0x12, 0x12, 0x12, 0x12}, 0xff, 0x00 },
184
    { {0x23, 0x2f, 0x3b, 0x47, 0x13, 0x13, 0x13, 0x13}, 0xff, 0x00 },
185
    { {0x24, 0x30, 0x3c, 0x48, 0x14, 0x14, 0x14, 0x14}, 0xff, 0x00 },
186
    { {0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05}, 0xff, 0x00 },
187
    { {0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06}, 0xff, 0x00 },
188
    { {0x4b, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37}, 0x80, 0x02 },
189
    { {0x4c, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38}, 0x80, 0x02 },
190
    { {0x4d, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39}, 0x80, 0x02 },
191
    { {0x4e, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d}, 0x80, 0x02 },
192
    { {0x4f, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34}, 0x80, 0x02 },
193
    { {0x50, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35}, 0x80, 0x02 },
194
    { {0x51, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, 0x80, 0x02 },
195
    { {0x52, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b}, 0x80, 0x02 },
196
    { {0x53, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31}, 0x80, 0x02 },
197
    { {0x54, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32}, 0x80, 0x02 },
198
    { {0x55, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33}, 0x80, 0x02 },
199
    { {0x56, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30}, 0x80, 0x02 },
200
    { {0x7f, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x85, 0x85}, 0x03, 0x02 },
201
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0xff, 0x00 },
202
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0xff, 0x00 },
203
    { {0x3c, 0x3e, 0x00, 0x00, 0x7c, 0xa6, 0x00, 0x00}, 0x33, 0x00 },
204
    { {0x25, 0x31, 0x3d, 0x49, 0x15, 0x15, 0x15, 0x15}, 0xff, 0x00 },
205
    { {0x26, 0x32, 0x3e, 0x4a, 0x16, 0x16, 0x16, 0x16}, 0xff, 0x00 },
206
    { {0x0d, 0x0d, 0x0a, 0x0a, 0x0d, 0x0d, 0x0a, 0x0a}, 0x00, 0x00 },
207
    { {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80}, 0xff, 0x00 },
208
    { {0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f}, 0x00, 0x02 },
209
    { {0x0a, 0x99, 0x86, 0x86, 0x00, 0x00, 0x00, 0x00}, 0xff, 0x00 },
210
    { {0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81}, 0xff, 0x00 },
211
    { {0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b}, 0xff, 0x00 },
212
    { {0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c}, 0xff, 0x00 },
213
    { {0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d}, 0xff, 0x00 },
214
    { {0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f}, 0xff, 0x00 },
215
    { {0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51}, 0xff, 0x00 },
216
    { {0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53}, 0xff, 0x00 },
217
    { {0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54}, 0xff, 0x00 },
218
    { {0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55}, 0xff, 0x00 },
219
    { {0x56, 0xa3, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56}, 0xff, 0x00 },
220
    { {0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x85, 0x57}, 0xff, 0x00 },
221
    { {0x06, 0x88, 0x06, 0x88, 0x87, 0x00, 0x87, 0x00}, 0xff, 0x00 },
222
    { {0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58}, 0xff, 0x00 },
223
    { {0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59}, 0xff, 0x00 },
224
    { {0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a}, 0xff, 0x00 },
225
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0xff, 0x00 },
226
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
227
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
228
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
229
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
230
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
231
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
232
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
233
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
234
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
235
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
236
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
237
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
238
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
239
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
240
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
241
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
242
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
243
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
244
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
245
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
246
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
247
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
248
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
249
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
250
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
251
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
252
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
253
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
254
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
255
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
256
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
257
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
258
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
259
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
260
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
261
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
262
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
263
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
264
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
265
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
266
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
267
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
268
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
269
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
270
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
271
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
272
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
273
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
274
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
275
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
276
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
277
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
278
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
279
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
280
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
281
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
282
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
283
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
284
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
285
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
286
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
287
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
288
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
289
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
290
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
291
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
292
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
293
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
294
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
295
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
296
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
297
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
298
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
299
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
300
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
301
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
302
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
303
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
304
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
305
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
306
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
307
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
308
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
309
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
310
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
311
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
312
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
313
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
314
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
315
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
316
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
317
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
318
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
319
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
320
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
321
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
322
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
323
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
324
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
325
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
326
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
327
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
328
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
329
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
330
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
331
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
332
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
333
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
334
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
335
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
336
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
337
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
338
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
339
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
340
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
341
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
342
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
343
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
344
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
345
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
346
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
347
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
348
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
349
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
350
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
351
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
352
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
353
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
354
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
355
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
356
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
357
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
358
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
359
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
360
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
361
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
362
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
363
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
364
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
365
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
366
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
367
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
368
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
369
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
370
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
371
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 },
372
    { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 0x00, 0x00 }
373
    //  |     |     |     |     |     |     |     |
374
    //  |     |     |     |     |     |     |     `--- 0: Shift-Ctrl-Alt
375
    //  |     |     |     |     |     |     `--------- 1: Ctrl-Alt
376
    //  |     |     |     |     |     `--------------- 2: Shift-Alt
377
    //  |     |     |     |     `--------------------- 3: Alt
378
    //  |     |     |     `--------------------------- 4: Shift-Ctrl
379
    //  |     |     `--------------------------------- 5: Ctrl
380
    //  |     `--------------------------------------- 6: Shift
381
    //  `--------------------------------------------- 7: Base
382
    //                                                 |
383
    //                                                 `- spcl bit
384
    //
385
    // spcl = A special treatment key (bits correspond to the map field)
386
    // flag = 0 -> 'O' = Caps lock + num lock are ignored
387
    // flag = 1 -> 'C' = Caps lock affects the key
388
    // flag = 2 -> 'N' = Num lock affects the key
389
  }
390
};
391

392
// static class attributes
393
//----------------------------------------------------------------------
394
keymap_t FSystemTest::terminal_keymap{};
395

396

397
// public methods of FSystemTest
398
//----------------------------------------------------------------------
399
auto FSystemTest::inPortByte (uShort) noexcept -> uChar
×
400
{
401
  return 0;
×
402
}
403

404
//----------------------------------------------------------------------
405
void FSystemTest::outPortByte (uChar, uShort) noexcept
×
406
{
407
}
×
408

409
//----------------------------------------------------------------------
410
auto FSystemTest::isTTY (int file_descriptor) const noexcept -> int
×
411
{
412
  std::cerr << "Call: isatty (file_descriptor=" << file_descriptor << ")\n";
×
413
  return 1;
×
414
}
415

416
//----------------------------------------------------------------------
417
auto FSystemTest::ioctl (int file_descriptor, uLong request, ...) noexcept -> int
22✔
418
{
419
  va_list args{};
22✔
420
  void* argp{};
22✔
421
  std::string req_string{};
22✔
422
  int ret_val{-1};
22✔
423

424
  va_start (args, request);
22✔
425
  argp = va_arg (args, void*);
22✔
426

427
  switch ( request )
22✔
428
  {
429
    case CONS_CURSORTYPE:
4✔
430
    {
431
      req_string = "CONS_CURSORTYPE";
4✔
432
      static constexpr int blink_cursor  = int(1 << 0);
433
      static constexpr int char_cursor   = int(1 << 1);
434
      static constexpr int hidden_cursor = int(1 << 2);
435
      static constexpr int reset_cursor  = int(1 << 30);
436
      static constexpr int cursor_attrs  = int( blink_cursor \
437
                                              | char_cursor \
438
                                              | hidden_cursor );
439
      int* cur_flags = static_cast<int*>(argp);
4✔
440
      *cur_flags = *cur_flags & cursor_attrs;
4✔
441

442
      if ( *cur_flags & reset_cursor )
4✔
443
        cursor_type = 0;
×
444
      else
445
        cursor_type = *cur_flags;
4✔
446

447
      ret_val = 0;
4✔
448
      break;
4✔
449
    }
450

451
    case GIO_KEYMAP:
15✔
452
    {
453
      req_string = "GIO_KEYMAP";
15✔
454
      auto kmap = static_cast<keymap_t*>(argp);
15✔
455

456
      // Sets the default keymap of the terminal on the first call
457
      if ( terminal_keymap.n_keys == 0 )
15✔
458
      {
459
        terminal_keymap.n_keys = keymap.n_keys;
1✔
460
        std::memcpy (terminal_keymap.key, &keymap.key, sizeof(keymap.key));
1✔
461
      }
462

463
      kmap->n_keys = terminal_keymap.n_keys;
15✔
464
      std::memcpy (kmap->key, terminal_keymap.key, sizeof(keymap.key));
15✔
465
      ret_val = 0;
15✔
466
      break;
15✔
467
    }
468

469
    case PIO_KEYMAP:
2✔
470
    {
471
      req_string = "PIO_KEYMAP";
2✔
472
      auto kmap = static_cast<keymap_t*>(argp);
2✔
473
      std::memcpy (terminal_keymap.key, kmap->key, sizeof(keymap.key));
2✔
474
      ret_val = 0;
2✔
475
      break;
2✔
476
    }
477

478
    case TIOCGWINSZ:
1✔
479
      req_string = "TIOCGWINSZ";
1✔
480
      auto win_size = static_cast<winsize*>(argp);
1✔
481
      win_size->ws_col = 80;
1✔
482
      win_size->ws_row = 25;
1✔
483
      ret_val = 0;
1✔
484
      break;
1✔
485
  }
486

487
  va_end (args);
22✔
488

489
  std::cerr << "Call: ioctl (file_descriptor=" << file_descriptor
22✔
490
            << ", request=" << req_string
491
            << "(0x" << std::hex << request << ")"
22✔
492
            << ", argp=" << argp << std::dec << ")\n";
22✔
493
  return ret_val;
44✔
494
}
22✔
495

496
//----------------------------------------------------------------------
497
auto FSystemTest::pipe (finalcut::PipeData& pipe) noexcept -> int
×
498
{
499
  std::cerr << "Call: pipe (pipefd={" << pipe.getReadFd() << ", "
×
500
            << pipe.getWriteFd() << "})\n";
×
501
  return 0;
×
502
}
503

504
//----------------------------------------------------------------------
505
auto FSystemTest::open (const char* pathname, int flags, ...) noexcept -> int
×
506
{
507
  va_list args{};
×
508
  va_start (args, flags);
×
509
  auto mode = static_cast<mode_t>(va_arg (args, int));
×
510
  va_end (args);
×
511

512
  std::cerr << "Call: open (pathname=\"" << pathname
513
            << "\", flags=" << flags
×
514
            << ", mode=" << mode << ")\n";
×
515

516
  return 0;
×
517
}
518

519
//----------------------------------------------------------------------
520
auto FSystemTest::close (int file_descriptor) noexcept -> int
×
521
{
522
  std::cerr << "Call: close (file_descriptor=" << file_descriptor << ")\n";
×
523
  return 0;
×
524
}
525

526
//----------------------------------------------------------------------
527
auto FSystemTest::fopen (const char* path, const char* mode) noexcept -> FILE*
×
528
{
529
  std::cerr << "Call: fopen (path=" << path
530
            << ", mode=" << mode << ")\n";
×
531
  return nullptr;
×
532
}
533

534
//----------------------------------------------------------------------
535
auto FSystemTest::fclose (FILE* file_ptr) noexcept -> int
×
536
{
537
  std::cerr << "Call: fclose (file_ptr=" << file_ptr << ")\n";
×
538
  return 0;
×
539
}
540

541
//----------------------------------------------------------------------
542
auto FSystemTest::fputs (const char* str, FILE* stream) noexcept -> int
×
543
{
544
  std::cerr << "Call: fputs (" << str << ", " << stream << ")\n";
×
545
  std::string string = str;
×
546
  int count = 0;
×
547

548
  for (auto&& ch : string)
×
549
  {
550
    characters.push_back(ch);
×
551
    count++;
×
552
  }
553

554
  return count;
×
555
}
×
556

557
//----------------------------------------------------------------------
558
auto FSystemTest::putchar (int c) noexcept -> int
20✔
559
{
560
  std::cerr << "Call: putchar (" << c << ")\n";
20✔
561
  characters.push_back(char(c));
20✔
562
  return 1;
20✔
563
}
564

565
//----------------------------------------------------------------------
566
auto FSystemTest::putstring (const char* str, std::size_t len) noexcept -> int
×
567
{
568
  return std::fwrite(str, 1, len, stdout);
×
569
}
570

571
//----------------------------------------------------------------------
572
auto FSystemTest::sigaction ( int, const struct sigaction*
×
573
                            , struct sigaction* ) noexcept -> int
574
{
575
  return 0;
×
576
}
577

578
//----------------------------------------------------------------------
579
auto FSystemTest::timer_create ( clockid_t, struct sigevent*
×
580
                               , timer_t* ) noexcept -> int
581
{
582
  return 0;
×
583
}
584

585
//----------------------------------------------------------------------
586
auto FSystemTest::timer_settime ( timer_t, int
×
587
                                , const struct itimerspec*
588
                                , struct itimerspec* ) noexcept -> int
589
{
590
  return 0;
×
591
}
592

593
//----------------------------------------------------------------------
594
auto FSystemTest::timer_delete (timer_t) noexcept -> int
×
595
{
596
  return 0;
×
597
}
598

599
//----------------------------------------------------------------------
600
auto FSystemTest::kqueue() noexcept -> int
×
601
{
602
  return 0;
×
603
}
604

605
//----------------------------------------------------------------------
606
auto FSystemTest::kevent ( int, const struct kevent*
×
607
                         , int, struct kevent*
608
                         , int, const struct timespec*) noexcept -> int
609
{
610
  return 0;
×
611
}
612

613
//----------------------------------------------------------------------
614
auto FSystemTest::getuid() noexcept -> uid_t
×
615
{
616
  return 0;
×
617
}
618

619
//----------------------------------------------------------------------
620
auto FSystemTest::geteuid() noexcept -> uid_t
×
621
{
622
  return 0;
×
623
}
624

625
//----------------------------------------------------------------------
626
auto FSystemTest::getpwuid_r ( uid_t, struct passwd*, char*
×
627
                            , size_t, struct passwd** ) noexcept -> int
628
{
629
  return 0;
×
630
}
631

632
//----------------------------------------------------------------------
633
auto FSystemTest::realpath (const char*, char*) noexcept -> char*
×
634
{
635
  return const_cast<char*>("");
×
636
}
637

638
//----------------------------------------------------------------------
639
auto FSystemTest::getCharacters() noexcept -> std::string&
1✔
640
{
641
  return characters;
1✔
642
}
643

644
//----------------------------------------------------------------------
645
auto FSystemTest::getCursorType() noexcept -> int&
3✔
646
{
647
  return cursor_type;
3✔
648
}
649

650
//----------------------------------------------------------------------
651
auto FSystemTest::getTerminalKeymap() noexcept -> struct keymap_t&
1✔
652
{
653
  return terminal_keymap;
1✔
654
}
655

656
}  // namespace test
657

658

659
//----------------------------------------------------------------------
660
// class ftermfreebsdTest
661
//----------------------------------------------------------------------
662

663
class ftermfreebsdTest : public CPPUNIT_NS::TestFixture
664
                       , test::ConEmu
665
{
666
  public:
667
    ftermfreebsdTest() = default;
4✔
668

669
  protected:
670
    void classNameTest();
671
    void freebsdConsoleTest();
672

673
  private:
674
    // Adds code needed to register the test suite
675
    CPPUNIT_TEST_SUITE (ftermfreebsdTest);
4✔
676

677
    // Add a methods to the test suite
678
    CPPUNIT_TEST (classNameTest);
4✔
679
    CPPUNIT_TEST (freebsdConsoleTest);
4✔
680

681
    // End of test suite definition
682
    CPPUNIT_TEST_SUITE_END();
6✔
683
    auto charEncode (finalcut::UniChar) -> wchar_t;
684
    auto charEncode (wchar_t) -> wchar_t;
685
};
686

687
//----------------------------------------------------------------------
688
void ftermfreebsdTest::classNameTest()
2✔
689
{
690
  const auto& freebsd = finalcut::FTermFreeBSD::getInstance();
2✔
691
  const finalcut::FString& classname = freebsd.getClassName();
2✔
692
  CPPUNIT_ASSERT ( classname == "FTermFreeBSD" );
10✔
693
}
2✔
694

695
//----------------------------------------------------------------------
696
void ftermfreebsdTest::freebsdConsoleTest()
2✔
697
{
698
  setenv ("TERM", "xterm", 1);
2✔
699
  setenv ("COLUMNS", "80", 1);
2✔
700
  setenv ("LINES", "25", 1);
2✔
701

702
  std::unique_ptr<finalcut::FSystem> fsys = std::make_unique<test::FSystemTest>();
2✔
703
  finalcut::FTerm::setFSystem(fsys);
2✔
704
  std::cout << "\n";
2✔
705
  auto& data = finalcut::FTermData::getInstance();
2✔
706

707
  auto& encoding_list = data.getEncodingList();
2✔
708
  encoding_list["UTF-8"] = finalcut::Encoding::UTF8;
4✔
709
  encoding_list["UTF8"]  = finalcut::Encoding::UTF8;
4✔
710
  encoding_list["VT100"] = finalcut::Encoding::VT100;
4✔
711
  encoding_list["PC"]    = finalcut::Encoding::PC;
4✔
712
  encoding_list["ASCII"] = finalcut::Encoding::ASCII;
2✔
713

714
  data.setTermEncoding(finalcut::Encoding::VT100);
2✔
715
  data.setBaudrate(9600);
2✔
716
  data.setTermType("xterm");
4✔
717
  data.setTermFileName("/dev/ttyv0");
2✔
718
  data.setTTYFileDescriptor(0);
2✔
719
  data.supportShadowCharacter (false);
2✔
720
  data.supportHalfBlockCharacter (false);
2✔
721
  data.supportCursorOptimisation (true);
2✔
722
  data.setCursorHidden (true);
2✔
723
  data.useAlternateScreen (false);
2✔
724
  data.setASCIIConsole (true);
2✔
725
  data.setVT100Console (false);
2✔
726
  data.setUTF8Console (false);
2✔
727
  data.setUTF8 (false);
2✔
728
  data.setNewFont (false);
2✔
729
  data.setVGAFont (false);
2✔
730
  data.setMonochron (false);
2✔
731
  data.setTermResized (false);
2✔
732

733
  // setupterm is needed for tputs in ncurses >= 6.1
734
  setupterm (static_cast<char*>(nullptr), 1, static_cast<int*>(nullptr));
2✔
735

736
  auto& term_detection = finalcut::FTermDetection::getInstance();
2✔
737
  term_detection.setTerminalDetection(true);
2✔
738
  finalcut::FTermcap::init();
2✔
739

740
  pid_t pid = forkConEmu();
2✔
741

742
  if ( isConEmuChildProcess(pid) )
2✔
743
  {
744
    // (gdb) set follow-fork-mode child
745
    static constexpr int left_alt = 0x38;
746
    finalcut::FTermFreeBSD freebsd;
747
    const auto& fsystem = finalcut::FSystem::getInstance();
1✔
748
    auto fsystest = static_cast<test::FSystemTest*>(fsystem.get());
1✔
749
    struct keymap_t& keymap = fsystest->getTerminalKeymap();
1✔
750

751
    setenv ("TERM", "xterm", 1);
1✔
752
    setenv ("COLUMNS", "80", 1);
1✔
753
    setenv ("LINES", "25", 1);
1✔
754
    unsetenv("TERMCAP");
1✔
755
    unsetenv("COLORTERM");
1✔
756
    unsetenv("COLORFGBG");
1✔
757
    unsetenv("VTE_VERSION");
1✔
758
    unsetenv("XTERM_VERSION");
1✔
759
    unsetenv("ROXTERM_ID");
1✔
760
    unsetenv("KONSOLE_DBUS_SESSION");
1✔
761
    unsetenv("KONSOLE_DCOP");
1✔
762
    unsetenv("TMUX");
1✔
763

764
    finalcut::FTerm::detectTermSize();
1✔
765
    CPPUNIT_ASSERT ( keymap.key[left_alt].map[0] == 0 );
6✔
766
    CPPUNIT_ASSERT ( freebsd.isFreeBSDConsole() );
6✔
767
    CPPUNIT_ASSERT ( keymap.key[left_alt].map[0] == 7 );
6✔
768
    CPPUNIT_ASSERT ( freebsd.getCursorStyle()
5✔
769
                     == finalcut::FreeBSDConsoleCursorStyle::Normal );
770
    freebsd.disableMetaSendsEscape();
1✔
771
    freebsd.disableChangeCursorStyle();
1✔
772
    freebsd.init();
1✔
773
    CPPUNIT_ASSERT ( keymap.key[left_alt].map[0] == 7 );
6✔
774
    CPPUNIT_ASSERT ( freebsd.getCursorStyle()
5✔
775
                     == finalcut::FreeBSDConsoleCursorStyle::Normal );
776
    freebsd.enableMetaSendsEscape();
1✔
777
    freebsd.enableChangeCursorStyle();
1✔
778
    freebsd.init();
1✔
779
    CPPUNIT_ASSERT ( keymap.key[left_alt].map[0] == META );
6✔
780
    CPPUNIT_ASSERT ( freebsd.getCursorStyle()
5✔
781
                     == finalcut::FreeBSDConsoleCursorStyle::Destructive );
782
    freebsd.setCursorStyle(finalcut::FreeBSDConsoleCursorStyle::Blink);
1✔
783
    freebsd.setCursorStyle(freebsd.getCursorStyle());
1✔
784
    CPPUNIT_ASSERT ( freebsd.getCursorStyle()
5✔
785
                     == finalcut::FreeBSDConsoleCursorStyle::Blink );
786

787
    const auto c1 = finalcut::UniChar::Section;                      // §
1✔
788
    const auto c2 = finalcut::UniChar::InverseBullet;                // ◘
1✔
789
    const auto c3 = finalcut::UniChar::InverseWhiteCircle;           // ◙
1✔
790
    const auto c4 = finalcut::UniChar::DoubleExclamationMark;        // ‼
1✔
791
    const auto c5 = finalcut::UniChar::UpDownArrow;                  // ↕
1✔
792
    const auto c6 = finalcut::UniChar::BlackRectangle;               // ▬
1✔
793
    const auto c7 = finalcut::UniChar::UpwardsArrow;                 // ↑
1✔
794
    const auto c8 = finalcut::UniChar::DownwardsArrow;               // ↓
1✔
795
    const auto c9 = finalcut::UniChar::RightwardsArrow;              // →
1✔
796
    const auto c10 = finalcut::UniChar::LeftwardsArrow;              // ←
1✔
797
    const auto c11 = finalcut::UniChar::Bullet;                      // •
1✔
798
    const auto c12 = finalcut::UniChar::BlackCircle;                 // ●
1✔
799
    const auto c13 = finalcut::UniChar::BlackDiamondSuit;            // ◆
1✔
800
    const auto c14 = finalcut::UniChar::BlackRightPointingTriangle;  // ▶
1✔
801
    const auto c15 = finalcut::UniChar::BlackLeftPointingTriangle;   // ◀
1✔
802
    const auto c16 = finalcut::UniChar::BlackRightPointingPointer;   // ►
1✔
803
    const auto c17 = finalcut::UniChar::BlackLeftPointingPointer;    // ◄
1✔
804
    CPPUNIT_ASSERT ( charEncode(c1) == 21 );   // §
6✔
805
    CPPUNIT_ASSERT ( charEncode(c2) == 8 );    // ◘
6✔
806
    CPPUNIT_ASSERT ( charEncode(c3) == 10 );   // ◙
6✔
807
    CPPUNIT_ASSERT ( charEncode(c4) == 19 );   // ‼
6✔
808
    CPPUNIT_ASSERT ( charEncode(c5) == 18 );   // ↕
6✔
809
    CPPUNIT_ASSERT ( charEncode(c6) == 22 );   // ▬
6✔
810
    CPPUNIT_ASSERT ( charEncode(c7) == 24 );   // ↑
6✔
811
    CPPUNIT_ASSERT ( charEncode(c8) == 25 );   // ↓
6✔
812
    CPPUNIT_ASSERT ( charEncode(c9) == 26 );   // →
6✔
813
    CPPUNIT_ASSERT ( charEncode(c10) == 27 );  // ←
6✔
814
    CPPUNIT_ASSERT ( charEncode(c11) == 4 );   // •
6✔
815
    CPPUNIT_ASSERT ( charEncode(c12) == 4 );   // ●
6✔
816
    CPPUNIT_ASSERT ( charEncode(c13) == 4 );   // ◆
6✔
817
    CPPUNIT_ASSERT ( charEncode(c14) == 16 );  // ▶
6✔
818
    CPPUNIT_ASSERT ( charEncode(c15) == 17 );  // ◀
6✔
819
    CPPUNIT_ASSERT ( charEncode(c16) == 16 );  // ►
6✔
820
    CPPUNIT_ASSERT ( charEncode(c17) == 17 );  // ◄
5✔
821

822
    freebsd.initCharMap();
1✔
823

824
    CPPUNIT_ASSERT ( charEncode(c1) == 36 );   // $
6✔
825
    CPPUNIT_ASSERT ( charEncode(c2) == 42 );   // *
6✔
826
    CPPUNIT_ASSERT ( charEncode(c3) == 42 );   // *
6✔
827
    CPPUNIT_ASSERT ( charEncode(c4) == 33 );   // !
6✔
828
    CPPUNIT_ASSERT ( charEncode(c5) == 73 );   // I
6✔
829
    CPPUNIT_ASSERT ( charEncode(c6) == 95 );   // _
6✔
830
    CPPUNIT_ASSERT ( charEncode(c7) == 94 );   // ^
6✔
831
    CPPUNIT_ASSERT ( charEncode(c8) == 118 );  // v
6✔
832
    CPPUNIT_ASSERT ( charEncode(c9) == 62 );   // >
6✔
833
    CPPUNIT_ASSERT ( charEncode(c10) == 60 );  // <
6✔
834
    CPPUNIT_ASSERT ( charEncode(c11) == 42 );  // *
6✔
835
    CPPUNIT_ASSERT ( charEncode(c12) == 42 );  // *
6✔
836
    CPPUNIT_ASSERT ( charEncode(c13) == 42 );  // *
6✔
837
    CPPUNIT_ASSERT ( charEncode(c14) == 62 );  // >
6✔
838
    CPPUNIT_ASSERT ( charEncode(c15) == 60 );  // <
6✔
839
    CPPUNIT_ASSERT ( charEncode(c16) == 62 );  // >
6✔
840
    CPPUNIT_ASSERT ( charEncode(c17) == 60 );  // <
5✔
841

842
    term_detection.detect();
1✔
843

844
#if DEBUG
845
    const finalcut::FString& sec_da = \
846
        finalcut::FTermDebugData::getInstance().getSecDAString();
1✔
847
    CPPUNIT_ASSERT ( sec_da == "\033[>0;10;0c" );
6✔
848
#endif
849

850
    CPPUNIT_ASSERT ( ::isatty(0) == 1 );
6✔
851
    CPPUNIT_ASSERT ( data.isTermType(finalcut::FTermType::freebsd_con) );
6✔
852
    CPPUNIT_ASSERT ( data.getTerminalGeometry().getWidth() == 80 );
6✔
853
    CPPUNIT_ASSERT ( data.getTerminalGeometry().getHeight() == 25 );
6✔
854
    CPPUNIT_ASSERT ( ! data.hasShadowCharacter() );
6✔
855
    CPPUNIT_ASSERT ( ! data.hasHalfBlockCharacter() );
5✔
856

857
    data.setCursorHidden (false);
1✔
858
    freebsd.setCursorStyle (finalcut::FreeBSDConsoleCursorStyle::Normal);
1✔
859

860
    CPPUNIT_ASSERT ( fsystest->getCursorType()
5✔
861
                     == int(finalcut::FreeBSDConsoleCursorStyle::Normal) );
862

863
    freebsd.setCursorStyle (finalcut::FreeBSDConsoleCursorStyle::Blink);
1✔
864
    CPPUNIT_ASSERT ( fsystest->getCursorType()
5✔
865
                     == int(finalcut::FreeBSDConsoleCursorStyle::Blink) );
866

867
    freebsd.setCursorStyle (finalcut::FreeBSDConsoleCursorStyle::Destructive);
1✔
868
    CPPUNIT_ASSERT ( fsystest->getCursorType()
5✔
869
                     == int(finalcut::FreeBSDConsoleCursorStyle::Destructive) );
870

871
    std::string& characters = fsystest->getCharacters();
1✔
872
    characters.clear();
1✔
873

874
    freebsd.setBeep (20, 100);     // Hz < 21
1✔
875
    CPPUNIT_ASSERT ( characters.empty() );
5✔
876
    freebsd.setBeep (32767, 100);  // Hz > 32766
1✔
877
    CPPUNIT_ASSERT ( characters.empty() );
5✔
878
    freebsd.setBeep (200, -1);     // ms < 0
1✔
879
    CPPUNIT_ASSERT ( characters.empty() );
5✔
880
    freebsd.setBeep (200, 2000);   // ms > 1999
1✔
881
    CPPUNIT_ASSERT ( characters.empty() );
5✔
882
    freebsd.setBeep (200, 100);    // 200 Hz - 100 ms
1✔
883

884
    CPPUNIT_ASSERT ( characters == CSI "=5965;10B" );
5✔
885
    characters.clear();
1✔
886

887
    freebsd.resetBeep();
1✔
888
    CPPUNIT_ASSERT ( characters == CSI "=800;5B" );
5✔
889
    characters.clear();
1✔
890

891
    freebsd.finish();
1✔
892

893
    closeConEmuStdStreams();
1✔
894
    exit(EXIT_SUCCESS);
1✔
895
  }
896
  else  // Parent
897
  {
898
    // Start the terminal emulation
899
    startConEmuTerminal (ConEmu::console::freebsd_con);
1✔
900
    int wstatus;
901

902
    if ( waitpid(pid, &wstatus, WUNTRACED) != pid )
1✔
903
      std::cerr << "waitpid error" << std::endl;
×
904

905
    if ( WIFEXITED(wstatus) )
1✔
906
      CPPUNIT_ASSERT ( WEXITSTATUS(wstatus) == 0 );
6✔
907
  }
908
}
1✔
909

910
//----------------------------------------------------------------------
911
auto ftermfreebsdTest::charEncode (finalcut::UniChar c) -> wchar_t
34✔
912
{
913
  return charEncode(static_cast<wchar_t>(c));
34✔
914
}
915

916
//----------------------------------------------------------------------
917
auto ftermfreebsdTest::charEncode (wchar_t c) -> wchar_t
34✔
918
{
919
  wchar_t ch_enc{L'\0'};
34✔
920

921
  for (auto&& entry : finalcut::FCharMap::getInstance().getCharEncodeMap())
832✔
922
  {
923
    if ( entry.unicode == c )
832✔
924
    {
925
      ch_enc = entry.pc;
34✔
926
      break;
34✔
927
    }
928
  }
929

930
  return ch_enc;
34✔
931
}
932

933
// Put the test suite in the registry
934
CPPUNIT_TEST_SUITE_REGISTRATION (ftermfreebsdTest);
935

936
// The general unit test main part
937
#include <main-test.inc>
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc