Example #1
0
TEST_F(CalculatorTest, PrintAlignedOnMainDisplayUR) {
    ncurses::stdscr->_maxx = 59;
    c.resize();
    EXPECT_EQ(c.getMainDisplayWindow()->x * 2 + c.getMainDisplayWindow()->_maxx, 60);
    print_aligned(c.getMainDisplayWindow(), "test", ALIGN_UR);
    EXPECT_EQ(c.getMainDisplayWindow()->histories[0].first.x, 48);

    ncurses::stdscr->_maxx = 60;
    c.resize();
    EXPECT_EQ(c.getMainDisplayWindow()->x * 2 + c.getMainDisplayWindow()->_maxx, 60);
    print_aligned(c.getMainDisplayWindow(), "test", ALIGN_UR);
    EXPECT_EQ(c.getMainDisplayWindow()->histories[0].first.x, 48);

    ncurses::stdscr->_maxx = 61;
    c.resize();
    EXPECT_EQ(c.getMainDisplayWindow()->x * 2 + c.getMainDisplayWindow()->_maxx, 62);
    print_aligned(c.getMainDisplayWindow(), "test", ALIGN_UR);
    EXPECT_EQ(c.getMainDisplayWindow()->histories[0].first.x, 48);

    ncurses::stdscr->_maxx = 62;
    c.resize();
    EXPECT_EQ(c.getMainDisplayWindow()->x * 2 + c.getMainDisplayWindow()->_maxx, 62);
    print_aligned(c.getMainDisplayWindow(), "test", ALIGN_UR);
    EXPECT_EQ(c.getMainDisplayWindow()->histories[0].first.x, 48);
};
Example #2
0
std::ostream &
operator<<(std::ostream & os, const NBodySim & s)
{
    print_aligned(os, NBodySim::CONF_KEYS::N_PARTICLES,    s.m_n_particles);
    print_aligned(os, NBodySim::CONF_KEYS::N_STEPS,        s.m_n_steps);
    print_aligned(os, NBodySim::CONF_KEYS::SIMULATOR,      s.m_simulator);
    print_aligned(os, NBodySim::CONF_KEYS::VISUAL,         s.m_visual);

    if (s.m_visual) {
        print_aligned(os, NBodySim::CONF_KEYS::IMG_WIDTH,      s.m_img_width);
        print_aligned(os, NBodySim::CONF_KEYS::IMG_HEIGHT,     s.m_img_height);
        print_aligned(os, NBodySim::CONF_KEYS::PLOT_EVERY,     s.m_plot_every);
        print_aligned(os, NBodySim::CONF_KEYS::TIME_STEP,      s.m_time_step);
        print_aligned(os, NBodySim::CONF_KEYS::MAX_INITSPEED,  s.m_max_initspeed);
        print_aligned(os, NBodySim::CONF_KEYS::MAX_INITMASS,   s.m_max_initmass);
        print_aligned(os, NBodySim::CONF_KEYS::MAX_INITCHARGE, s.m_max_initcharge);
        print_aligned(os, NBodySim::CONF_KEYS::MIN_INITSPEED,  s.m_min_initspeed);
        print_aligned(os, NBodySim::CONF_KEYS::MIN_INITMASS,   s.m_min_initmass);
        print_aligned(os, NBodySim::CONF_KEYS::MIN_INITCHARGE, s.m_min_initcharge);
        print_aligned(os, NBodySim::CONF_KEYS::IMG_PREFIX,     s.m_img_prefix);
    }

    print_aligned(os, NBodySim::CONF_KEYS::DUMP_FILE,      s.m_dumpfile);
    print_aligned(os, NBodySim::CONF_KEYS::SEED,           s.m_seed);
    return os;
}