Skip to content

Commit f92f857

Browse files
authored
various small tests ... (#1786)
unclear but I want to and another file ...
1 parent 93ca3ea commit f92f857

File tree

9 files changed

+898
-20
lines changed

9 files changed

+898
-20
lines changed

src/basic_fun_jmg.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ namespace lib {
207207
}
208208

209209
if(type == "OBJREF"){
210-
rank=1; // alway array following ISA() doc.
211-
//cout << "OBJREF" << endl;
210+
// AC 2024/03/21 wrong here rank=1; // alway array following ISA() doc.
211+
// cout << "OBJREF" << endl;
212212
DObjGDL* obj = static_cast<DObjGDL*>(p0);
213213
DObj objID = (*obj)[0];
214214
if(objID == 0) res = false; else res = true;
@@ -224,7 +224,11 @@ namespace lib {
224224
else {
225225
objectName = str->Desc()->Name();
226226
}
227-
// cout << objectName << endl;
227+
SizeT nEl;
228+
if (str->Desc()->IsParent("LIST")) nEl=LIST_count(str);
229+
if (str->Desc()->IsParent("HASH")) nEl=HASH_count(str);
230+
if (debug) cout << objectName << " " << nEl<< endl;
231+
if (nEl > 0) rank=1;
228232
}
229233
}
230234

@@ -456,22 +460,21 @@ namespace lib {
456460
if( oStructGDL != NULL) // if object not valid -> default behaviour
457461
{
458462
DStructDesc* desc = oStructGDL->Desc();
459-
460463
if( desc->IsParent("LIST"))
461464
{
462-
isObjectContainer = true; nEl = LIST_count(oStructGDL);
465+
isObjectContainer = true; nEl = LIST_count(oStructGDL);
463466
}
464467
if( desc->IsParent("HASH"))
465468
{
466-
isObjectContainer = true; nEl = HASH_count(oStructGDL);
469+
isObjectContainer = true; nEl = HASH_count(oStructGDL);
467470
}
468471
}
469472
}
470473
}
471474

472475
if( isObjectContainer)
473476
{
474-
LogicalRank = 1;
477+
if (nEl > 0) LogicalRank = 1; // AC2024/03/21 bug #1725
475478
}
476479

477480
// DIMENSIONS

src/list.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,7 +2125,8 @@ BaseGDL* list__toarray( EnvUDT* e)
21252125

21262126
BaseGDL* list__isempty( EnvUDT* e)
21272127
{
2128-
2128+
std::cout << "par par ici et là" << std::endl;
2129+
21292130
GDL_LIST_STRUCT()
21302131

21312132
static int kwSELFIx = 0;
@@ -2137,16 +2138,20 @@ BaseGDL* list__isempty( EnvUDT* e)
21372138

21382139
SizeT LIST_count( DStructGDL* list)
21392140
{// straight through, no checks
2140-
static unsigned nListTag = structDesc::LIST->TagIndex( "NLIST");
2141-
return (*static_cast<DLongGDL*>( list->GetTag( nListTag, 0)))[0];
21422141

2142+
static unsigned nListTag = structDesc::LIST->TagIndex( "NLIST");
2143+
2144+
// std::cout << nListTag << std::endl;
2145+
return (*static_cast<DLongGDL*>( list->GetTag( nListTag, 0)))[0];
21432146
}
2147+
21442148
BaseGDL* list__count( EnvUDT* e)
21452149
{
21462150
static int kwSELFIx = 0; // no keywords
21472151
static int kwVALUEIx = 1;
2148-
2149-
// DStructGDL* self = GetOBJ( e->GetKW( kwSELFIx), e);
2152+
2153+
// std::cout << "ici ici" << std::endl;
2154+
// DStructGDL* self = GetOBJ( e->GetKW( kwSELFIx), e);
21502155
SizeT nParam = e->NParam(1);
21512156
if( nParam == 1)
21522157
return new DLongGDL( LIST_count( GetOBJ( e->GetTheKW( kwSELFIx), e)));

testsuite/LIST

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ test_bug_3189072.pro
3838
test_bug_3199465.pro
3939
test_bug_3285659.pro
4040
test_bug_3286031.pro
41-
test_bug_3288652.pro
4241
test_bug_3290532.pro
4342
test_bug_3296360.pro
4443
test_bug_3298378.pro
@@ -96,6 +95,7 @@ test_file_readlink.pro
9695
test_file_which.pro
9796
test_finite.pro
9897
test_fixprint.pro
98+
test_foreach.pro
9999
test_fx_root.pro
100100
test_fz_roots.pro
101101
test_gaussfit.pro
@@ -144,6 +144,7 @@ test_null.pro
144144
test_numeric_limits.pro
145145
test_obj_hasmethod.pro
146146
test_obj_valid.pro
147+
test_operators.pro
147148
test_parse_url.pro
148149
test_plot_ranges.pro
149150
test_plot_usersym.pro
@@ -202,5 +203,6 @@ test_wordexp.pro
202203
test_wordexp_null_string.pro
203204
test_xdr.pro
204205
test_xmlsax.pro
206+
test_xyztick_get.pro
205207
test_zeropoly.pro
206208
test_write_csv.pro

0 commit comments

Comments
 (0)