Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #2

Open
wants to merge 55 commits into
base: main
Choose a base branch
from
Open

Development #2

wants to merge 55 commits into from

Conversation

DeadPizza
Copy link
Collaborator

engine and tests

Copy link

@a-badin a-badin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хорошие тесты, напишите мне если у вас есть вопросы по умным указателям, засчитываю на 10


TEST(EvolutionTest, test_selectionCountOne)
{
DFWorldScene *sc = new DFWorldScene();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

утечка памяти, создавайте на стеке или через unique_ptr

DFWorldScene *sc = new DFWorldScene();
std::vector<Model*> stickmans;

for (int i = 0; i < 1; i++)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а зачем цикл? ++i

for (int i = 0; i < 1; i++)
{
DFEntity &stickman = sc->addNewObject("stickman_" + std::to_string(i));
stickman.addComponent(new StickmanPhysicsComponent());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нет new/delete - нет утечек

evo.Selection();
evo.getBestCount();

EXPECT_EQ(evo.getBestCount(), 7);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не совсем понятно почему 7 но ладно, не помешал бы комментарий

Link l(pm1, pm2, 10, 10, true);

auto oldLen = pm1.m_pos - pm2.m_pos;
float dist = oldLen.length();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ожидаемое значение должно вычисляться гарантировано работающим правильно кодом, еще лучше не вычислять его а просто захардкодить. В противном случае вы тестируете вашу логику против вашей логики


std::array<float, 11> res = {-0.103591, 0.604108, -0.986522, -0.997239, 0.971981, -0.5389, 0.903677, 0.916517, -0.162188, 0.974992, -0.864615};

for (int i = 0; i < 11; i++)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

res.size()

Copy link

@a-badin a-badin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хорошие тесты, напишите мне если у вас есть вопросы по умным указателям, засчитываю на 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants