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

polserver / polserver / 24035539233

06 Apr 2026 02:21PM UTC coverage: 60.76% (+0.06%) from 60.696%
24035539233

push

github

web-flow
using fmt instead of ostringstream (#873)

* using fmt instead of ostringstream

misc cleanup

* missing external libs for clang tidy check

* added test for cprops ignore while stacking
door descriptor

* use contains instead of count, removed disabled ancient code

* pack/packonto simplification/speedup

instead of using ostream and convert to string, use format and directly
a string

90 of 141 new or added lines in 17 files covered. (63.83%)

17 existing lines in 10 files now uncovered.

44503 of 73244 relevant lines covered (60.76%)

514255.82 hits per line

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

80.54
/pol-core/bscript/blong.cpp
1
/** @file
2
 *
3
 * @par History
4
 */
5

6

7
#include <fmt/compile.h>
8
#include <iterator>
9
#include <sstream>
10
#include <string>
11

12
#include "../clib/stlutil.h"
13
#include "berror.h"
14
#include "bobject.h"
15
#include "impstr.h"
16

17

18
namespace Pol::Bscript
19
{
20
using namespace fmt::literals;
21

22
#if BOBJECTIMP_DEBUG
23
BLong::BLong( int lval ) : BObjectImp( OTLong ), lval_( static_cast<int>( lval ) ) {}
24

25
BLong::BLong( const BLong& L ) : BObjectImp( OTLong ), lval_( L.lval_ ) {}
26
#endif
27

28

UNCOV
29
std::string BLong::pack( int val )
×
30
{
NEW
31
  return fmt::format( "i{}"_cf, val );
×
32
}
33

34

35
void BLong::packonto( std::string& str ) const
224✔
36
{
37
  fmt::format_to( std::back_inserter( str ), "i{}"_cf, lval_ );
224✔
38
}
224✔
39

40
BObjectImp* BLong::unpack( std::istream& is )
358✔
41
{
42
  int lv;
43
  if ( is >> lv )
358✔
44
  {
45
    return new BLong( lv );
358✔
46
  }
47

48
  return new BError( "Error extracting Integer value" );
×
49
}
50

51
BObjectImp* BLong::copy() const
17,906✔
52
{
53
  return new BLong( *this );
17,906✔
54
}
55

56
size_t BLong::sizeEstimate() const
1,727✔
57
{
58
  return sizeof( BLong );
1,727✔
59
}
60

61
bool BLong::isTrue() const
85,357✔
62
{
63
  return ( lval_ != 0 );
85,357✔
64
}
65

66
bool BLong::operator==( const BObjectImp& objimp ) const
14,627✔
67
{
68
  if ( objimp.isa( OTLong ) )
14,627✔
69
  {
70
    return lval_ == ( (BLong&)objimp ).lval_;
10,423✔
71
  }
72
  if ( objimp.isa( OTDouble ) )
4,204✔
73
  {
74
    return lval_ == ( (Double&)objimp ).value();
117✔
75
  }
76
  if ( objimp.isa( OTBoolean ) )
4,087✔
77
  {
78
    return isTrue() == static_cast<const BBoolean&>( objimp ).isTrue();
6✔
79
  }
80

81
  return false;
4,081✔
82
}
83

84
bool BLong::operator<( const BObjectImp& objimp ) const
16,566✔
85
{
86
  if ( objimp.isa( OTLong ) )
16,566✔
87
  {
88
    return lval_ < ( (BLong&)objimp ).lval_;
16,328✔
89
  }
90
  if ( objimp.isa( OTDouble ) )
238✔
91
  {
92
    return lval_ < ( (Double&)objimp ).value();
201✔
93
  }
94

95
  return base::operator<( objimp );
37✔
96
}
97

98
std::string BLong::getStringRep() const
13,634✔
99
{
100
  return fmt::to_string( lval_ );
13,634✔
101
}
102

103
BObjectImp* BLong::selfPlusObjImp( const BObjectImp& objimp ) const
13,190✔
104
{
105
  return objimp.selfPlusObj( *this );
13,190✔
106
}
107
BObjectImp* BLong::selfPlusObj( const BLong& objimp ) const
11,132✔
108
{
109
  return new BLong( lval_ + objimp.lval_ );
11,132✔
110
}
111
BObjectImp* BLong::selfPlusObj( const Double& objimp ) const
16✔
112
{
113
  return new Double( lval_ + objimp.value() );
16✔
114
}
115
BObjectImp* BLong::selfPlusObj( const String& objimp ) const
33✔
116
{
117
  return new String( getStringRep() + objimp.value() );
33✔
118
}
119

120
void BLong::selfPlusObjImp( BObjectImp& objimp, BObject& obj )
552✔
121
{
122
  objimp.selfPlusObj( *this, obj );
552✔
123
}
552✔
124
void BLong::selfPlusObj( BLong& objimp, BObject& /*obj*/ )
516✔
125
{
126
  lval_ += objimp.value();
516✔
127
}
516✔
128
void BLong::selfPlusObj( Double& objimp, BObject& obj )
3✔
129
{
130
  obj.setimp( selfPlusObj( objimp ) );
3✔
131
}
3✔
132
void BLong::selfPlusObj( String& objimp, BObject& obj )
3✔
133
{
134
  obj.setimp( selfPlusObj( objimp ) );
3✔
135
}
3✔
136

137
BObjectImp* BLong::selfMinusObjImp( const BObjectImp& objimp ) const
2,774✔
138
{
139
  return objimp.selfMinusObj( *this );
2,774✔
140
}
141
BObjectImp* BLong::selfMinusObj( const BLong& objimp ) const
2,744✔
142
{
143
  return new BLong( lval_ - objimp.value() );
2,744✔
144
}
145
BObjectImp* BLong::selfMinusObj( const Double& objimp ) const
16✔
146
{
147
  return new Double( lval_ - objimp.value() );
16✔
148
}
149
BObjectImp* BLong::selfMinusObj( const String& objimp ) const
21✔
150
{
151
  String s( getStringRep() );
21✔
152
  return s.selfMinusObj( objimp );
42✔
153
}
21✔
154
void BLong::selfMinusObjImp( BObjectImp& objimp, BObject& obj )
54✔
155
{
156
  objimp.selfMinusObj( *this, obj );
54✔
157
}
54✔
158
void BLong::selfMinusObj( BLong& objimp, BObject& /*obj*/ )
27✔
159
{
160
  lval_ -= objimp.value();
27✔
161
}
27✔
162
void BLong::selfMinusObj( Double& objimp, BObject& obj )
3✔
163
{
164
  obj.setimp( selfMinusObj( objimp ) );
3✔
165
}
3✔
166
void BLong::selfMinusObj( String& objimp, BObject& obj )
3✔
167
{
168
  obj.setimp( selfMinusObj( objimp ) );
3✔
169
}
3✔
170

171
BObjectImp* BLong::selfTimesObjImp( const BObjectImp& objimp ) const
1,241✔
172
{
173
  return objimp.selfTimesObj( *this );
1,241✔
174
}
175
BObjectImp* BLong::selfTimesObj( const BLong& objimp ) const
1,172✔
176
{
177
  return new BLong( lval_ * objimp.lval_ );
1,172✔
178
}
179
BObjectImp* BLong::selfTimesObj( const Double& objimp ) const
27✔
180
{
181
  return new Double( lval_ * objimp.value() );
27✔
182
}
183
void BLong::selfTimesObjImp( BObjectImp& objimp, BObject& obj )
54✔
184
{
185
  objimp.selfTimesObj( *this, obj );
54✔
186
}
54✔
187
void BLong::selfTimesObj( BLong& objimp, BObject& /*obj*/ )
27✔
188
{
189
  lval_ *= objimp.lval_;
27✔
190
}
27✔
191
void BLong::selfTimesObj( Double& objimp, BObject& obj )
3✔
192
{
193
  obj.setimp( selfTimesObj( objimp ) );
3✔
194
}
3✔
195

196
BObjectImp* BLong::selfDividedByObjImp( const BObjectImp& objimp ) const
56✔
197
{
198
  return objimp.selfDividedByObj( *this );
56✔
199
}
200
BObjectImp* BLong::selfDividedByObj( const BLong& objimp ) const
8✔
201
{
202
  int divisor = objimp.lval_;
8✔
203
  if ( !divisor )
8✔
204
    return new BError( "Divide by Zero" );
×
205
  return new BLong( lval_ / divisor );
8✔
206
}
207
BObjectImp* BLong::selfDividedByObj( const Double& objimp ) const
6✔
208
{
209
  double divisor = objimp.value();
6✔
210
  if ( divisor == 0.0 )
6✔
211
    return new BError( "Divide by Zero" );
×
212
  return new Double( lval_ / divisor );
6✔
213
}
214
void BLong::selfDividedByObjImp( BObjectImp& objimp, BObject& obj )
42✔
215
{
216
  objimp.selfDividedByObj( *this, obj );
42✔
217
}
42✔
218
void BLong::selfDividedByObj( BLong& objimp, BObject& obj )
15✔
219
{
220
  if ( !objimp.lval_ )
15✔
221
    obj.setimp( new BError( "Divide by Zero" ) );
×
222
  else
223
    lval_ /= objimp.lval_;
15✔
224
}
15✔
225
void BLong::selfDividedByObj( Double& objimp, BObject& obj )
3✔
226
{
227
  obj.setimp( selfDividedByObj( objimp ) );
3✔
228
}
3✔
229

230
BObjectImp* BLong::selfModulusObjImp( const BObjectImp& objimp ) const
144✔
231
{
232
  return objimp.selfModulusObj( *this );
144✔
233
}
234
BObjectImp* BLong::selfModulusObj( const BLong& objimp ) const
81✔
235
{
236
  int divisor = objimp.lval_;
81✔
237
  if ( !divisor )
81✔
238
    return new BError( "Divide by Zero" );
9✔
239
  return new BLong( lval_ % divisor );
72✔
240
}
241
BObjectImp* BLong::selfModulusObj( const Double& objimp ) const
78✔
242
{
243
  if ( !objimp.value() )
78✔
244
    return new BError( "Divide by Zero" );
18✔
245
  return new Double( fmod( lval_, objimp.value() ) );
60✔
246
}
247
void BLong::selfModulusObjImp( BObjectImp& objimp, BObject& obj )
105✔
248
{
249
  objimp.selfModulusObj( *this, obj );
105✔
250
}
105✔
251
void BLong::selfModulusObj( BLong& objimp, BObject& obj )
42✔
252
{
253
  if ( !objimp.lval_ )
42✔
254
    obj.setimp( new BError( "Divide by Zero" ) );
9✔
255
  else
256
    lval_ %= objimp.lval_;
33✔
257
}
42✔
258
void BLong::selfModulusObj( Double& objimp, BObject& obj )
39✔
259
{
260
  obj.setimp( selfModulusObj( objimp ) );
39✔
261
}
39✔
262

263

264
BObjectImp* BLong::selfBitShiftRightObjImp( const BObjectImp& objimp ) const
30✔
265
{
266
  return objimp.selfBitShiftRightObj( *this );
30✔
267
}
268
BObjectImp* BLong::selfBitShiftRightObj( const BLong& objimp ) const
3✔
269
{
270
  return new BLong( lval_ >> objimp.lval_ );
3✔
271
}
272
void BLong::selfBitShiftRightObjImp( BObjectImp& objimp, BObject& obj )
×
273
{
274
  objimp.selfBitShiftRightObj( *this, obj );
×
275
}
×
276
void BLong::selfBitShiftRightObj( BLong& objimp, BObject& /*obj*/ )
×
277
{
278
  lval_ >>= objimp.lval_;
×
279
}
×
280

281
BObjectImp* BLong::selfBitShiftLeftObjImp( const BObjectImp& objimp ) const
30✔
282
{
283
  return objimp.selfBitShiftLeftObj( *this );
30✔
284
}
285
BObjectImp* BLong::selfBitShiftLeftObj( const BLong& objimp ) const
3✔
286
{
287
  return new BLong( lval_ << objimp.lval_ );
3✔
288
}
289
void BLong::selfBitShiftLeftObjImp( BObjectImp& objimp, BObject& obj )
×
290
{
291
  objimp.selfBitShiftLeftObj( *this, obj );
×
292
}
×
293
void BLong::selfBitShiftLeftObj( BLong& objimp, BObject& /*obj*/ )
×
294
{
295
  lval_ <<= objimp.lval_;
×
296
}
×
297

298
BObjectImp* BLong::selfBitAndObjImp( const BObjectImp& objimp ) const
33✔
299
{
300
  return objimp.selfBitAndObj( *this );
33✔
301
}
302
BObjectImp* BLong::selfBitAndObj( const BLong& objimp ) const
5✔
303
{
304
  return new BLong( lval_ & objimp.lval_ );
5✔
305
}
306
void BLong::selfBitAndObjImp( BObjectImp& objimp, BObject& obj )
×
307
{
308
  objimp.selfBitAndObj( *this, obj );
×
309
}
×
310
void BLong::selfBitAndObj( BLong& objimp, BObject& /*obj*/ )
×
311
{
312
  lval_ &= objimp.lval_;
×
313
}
×
314

315
BObjectImp* BLong::selfBitOrObjImp( const BObjectImp& objimp ) const
30✔
316
{
317
  return objimp.selfBitOrObj( *this );
30✔
318
}
319
BObjectImp* BLong::selfBitOrObj( const BLong& objimp ) const
3✔
320
{
321
  return new BLong( lval_ | objimp.lval_ );
3✔
322
}
323
void BLong::selfBitOrObjImp( BObjectImp& objimp, BObject& obj )
×
324
{
325
  objimp.selfBitOrObj( *this, obj );
×
326
}
×
327
void BLong::selfBitOrObj( BLong& objimp, BObject& /*obj*/ )
×
328
{
329
  lval_ |= objimp.lval_;
×
330
}
×
331

332
BObjectImp* BLong::selfBitXorObjImp( const BObjectImp& objimp ) const
30✔
333
{
334
  return objimp.selfBitXorObj( *this );
30✔
335
}
336
BObjectImp* BLong::selfBitXorObj( const BLong& objimp ) const
3✔
337
{
338
  return new BLong( lval_ ^ objimp.lval_ );
3✔
339
}
340
void BLong::selfBitXorObjImp( BObjectImp& objimp, BObject& obj )
×
341
{
342
  objimp.selfBitXorObj( *this, obj );
×
343
}
×
344
void BLong::selfBitXorObj( BLong& objimp, BObject& /*obj*/ )
×
345
{
346
  lval_ ^= objimp.lval_;
×
347
}
×
348

349
BObjectImp* BLong::bitnot() const
24✔
350
{
351
  return new BLong( ~lval_ );
24✔
352
}
353
}  // namespace Pol::Bscript
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