Skip to content

Commit

Permalink
[DF] Adapt tests to changes in Display
Browse files Browse the repository at this point in the history
Co-authored-by: Vincenzo Eduardo Padulano <vincenzo.eduardo.padulano@cern.ch>
  • Loading branch information
ianna and vepadulano committed Feb 24, 2024
1 parent dd35cc5 commit b0f7965
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 102 deletions.
146 changes: 72 additions & 74 deletions tree/dataframe/test/dataframe_display.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,56 +9,54 @@ using namespace ROOT;
using namespace ROOT::RDF;
using namespace ROOT::VecOps;

static const std::string DisplayPrintDefaultRows("+-----+----+----+-----------+\n"
"| Row | b1 | b2 | b3 | \n"
"+-----+----+----+-----------+\n"
"| 0 | 0 | 1 | 2.0000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+-----------+\n"
"| 1 | 0 | 1 | 2.0000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+-----------+\n"
"| 2 | 0 | 1 | 2.0000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+-----------+\n"
"| 3 | 0 | 1 | 2.0000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+-----------+\n"
"| 4 | 0 | 1 | 2.0000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+-----------+\n"
);

static const std::string DisplayAsStringDefaultRows("+-----+----+----+-----------+\n"
"| Row | b1 | b2 | b3 | \n"
"+-----+----+----+-----------+\n"
"| 0 | 0 | 1 | 2.0000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+-----------+\n"
"| 1 | 0 | 1 | 2.0000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+-----------+\n"
"| 2 | 0 | 1 | 2.0000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+-----------+\n"
"| 3 | 0 | 1 | 2.0000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+-----------+\n"
"| 4 | 0 | 1 | 2.0000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"| | | | | \n"
"+-----+----+----+-----------+\n"
);
static const std::string DisplayPrintDefaultRows("+-----+----+----+----------+\n"
"| Row | b1 | b2 | b3 | \n"
"+-----+----+----+----------+\n"
"| 0 | 0 | 1 | 2.000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+----------+\n"
"| 1 | 0 | 1 | 2.000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+----------+\n"
"| 2 | 0 | 1 | 2.000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+----------+\n"
"| 3 | 0 | 1 | 2.000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+----------+\n"
"| 4 | 0 | 1 | 2.000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+----------+\n");

static const std::string DisplayAsStringDefaultRows("+-----+----+----+----------+\n"
"| Row | b1 | b2 | b3 | \n"
"+-----+----+----+----------+\n"
"| 0 | 0 | 1 | 2.000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+----------+\n"
"| 1 | 0 | 1 | 2.000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+----------+\n"
"| 2 | 0 | 1 | 2.000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+----------+\n"
"| 3 | 0 | 1 | 2.000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+----------+\n"
"| 4 | 0 | 1 | 2.000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"| | | | | \n"
"+-----+----+----+----------+\n");

TEST(RDFDisplayTests, DisplayNoJitDefaultRows)
{
Expand Down Expand Up @@ -141,30 +139,30 @@ TEST(RDFDisplayTests, DisplayRegexDefaultRows)
EXPECT_EQ(dd->AsString(), DisplayAsStringDefaultRows);
}

static const std::string DisplayPrintTwoRows("+-----+----+----+-----------+\n"
"| Row | b1 | b2 | b3 | \n"
"+-----+----+----+-----------+\n"
"| 0 | 0 | 1 | 2.0000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+-----------+\n"
"| 1 | 0 | 1 | 2.0000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+-----------+\n");

static const std::string DisplayAsStringTwoRows("+-----+----+----+-----------+\n"
"| Row | b1 | b2 | b3 | \n"
"+-----+----+----+-----------+\n"
"| 0 | 0 | 1 | 2.0000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+-----------+\n"
"| 1 | 0 | 1 | 2.0000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"| | | | | \n"
"+-----+----+----+-----------+\n");
static const std::string DisplayPrintTwoRows("+-----+----+----+----------+\n"
"| Row | b1 | b2 | b3 | \n"
"+-----+----+----+----------+\n"
"| 0 | 0 | 1 | 2.000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+----------+\n"
"| 1 | 0 | 1 | 2.000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+----------+\n");

static const std::string DisplayAsStringTwoRows("+-----+----+----+----------+\n"
"| Row | b1 | b2 | b3 | \n"
"+-----+----+----+----------+\n"
"| 0 | 0 | 1 | 2.000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"+-----+----+----+----------+\n"
"| 1 | 0 | 1 | 2.000000 | \n"
"| | | 2 | | \n"
"| | | 3 | | \n"
"| | | | | \n"
"+-----+----+----+----------+\n");

TEST(RDFDisplayTests, DisplayJitTwoRows)
{
Expand Down
56 changes: 28 additions & 28 deletions tree/dataframe/test/datasource_csv.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -390,34 +390,34 @@ TEST(RCsvDS, NanWarningChecks)

ROOT_EXPECT_WARNING(d->AsString(), "RCsvDS", Warn);

const std::string AsString = "+-----+------------+-------+------+----------------+\n"
"| Row | col1 | col3 | col6 | col8 | \n"
"+-----+------------+-------+------+----------------+\n"
"| 0 | 3.1400000 | false | 0 | \"nan\" | \n"
"+-----+------------+-------+------+----------------+\n"
"| 1 | 4.1400000 | false | 2 | \"R,Data,Frame\" | \n"
"+-----+------------+-------+------+----------------+\n"
"| 2 | nan | true | 3 | \"nan\" | \n"
"+-----+------------+-------+------+----------------+\n"
"| 3 | 5.1400000 | true | 4 | \"nan\" | \n"
"+-----+------------+-------+------+----------------+\n"
"| 4 | -6.1400000 | true | 5 | \"nan\" | \n"
"+-----+------------+-------+------+----------------+\n"
"| 5 | -7.1400000 | true | 6 | \"nan\" | \n"
"+-----+------------+-------+------+----------------+\n"
"| 6 | nan | true | 7 | \"nan\" | \n"
"+-----+------------+-------+------+----------------+\n"
"| 7 | nan | true | 8 | \"nan\" | \n"
"+-----+------------+-------+------+----------------+\n"
"| 8 | 3.1500000 | true | 9 | \"nan\" | \n"
"+-----+------------+-------+------+----------------+\n"
"| 9 | 5.1500000 | true | 10 | \"nan\" | \n"
"+-----+------------+-------+------+----------------+\n"
"| 10 | 6.1500000 | true | 11 | \"nan\" | \n"
"+-----+------------+-------+------+----------------+\n"
"| 11 | 6.1500000 | true | 12 | \"nan\" | \n"
"| | | | | | \n"
"+-----+------------+-------+------+----------------+\n";
const std::string AsString = "+-----+-----------+-------+------+----------------+\n"
"| Row | col1 | col3 | col6 | col8 | \n"
"+-----+-----------+-------+------+----------------+\n"
"| 0 | 3.140000 | false | 0 | \"nan\" | \n"
"+-----+-----------+-------+------+----------------+\n"
"| 1 | 4.140000 | false | 2 | \"R,Data,Frame\" | \n"
"+-----+-----------+-------+------+----------------+\n"
"| 2 | nan | true | 3 | \"nan\" | \n"
"+-----+-----------+-------+------+----------------+\n"
"| 3 | 5.140000 | true | 4 | \"nan\" | \n"
"+-----+-----------+-------+------+----------------+\n"
"| 4 | -6.140000 | true | 5 | \"nan\" | \n"
"+-----+-----------+-------+------+----------------+\n"
"| 5 | -7.140000 | true | 6 | \"nan\" | \n"
"+-----+-----------+-------+------+----------------+\n"
"| 6 | nan | true | 7 | \"nan\" | \n"
"+-----+-----------+-------+------+----------------+\n"
"| 7 | nan | true | 8 | \"nan\" | \n"
"+-----+-----------+-------+------+----------------+\n"
"| 8 | 3.150000 | true | 9 | \"nan\" | \n"
"+-----+-----------+-------+------+----------------+\n"
"| 9 | 5.150000 | true | 10 | \"nan\" | \n"
"+-----+-----------+-------+------+----------------+\n"
"| 10 | 6.150000 | true | 11 | \"nan\" | \n"
"+-----+-----------+-------+------+----------------+\n"
"| 11 | 6.150000 | true | 12 | \"nan\" | \n"
"| | | | | | \n"
"+-----+-----------+-------+------+----------------+\n";

EXPECT_EQ(d->AsString(), AsString);
}
Expand Down

0 comments on commit b0f7965

Please sign in to comment.