Skip to content

Conversation

@kamendov-maxim
Copy link
Owner

No description provided.

Console.WriteLine(queue.Dequeue());
Console.WriteLine(queue.Dequeue());
Console.WriteLine(queue.Dequeue());
Console.WriteLine(queue.Dequeue()); No newline at end of file

Choose a reason for hiding this comment

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

Это не нужно. Собирайте библиотеку и проверяйте работоспособность тестами

Comment on lines +1 to +3
using System.Security;

namespace DataStructures;

Choose a reason for hiding this comment

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

  • Не хватает заголовка с информацией о лицензии
  • namespace обычно пишут первой содержательной строкой в файле, сразу после лицензии, а using-и уже внутри


namespace DataStructures;

public class Queue<T>(int startCapacity = 1)

Choose a reason for hiding this comment

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

Надо комментарии ещё

public class Queue<T>(int startCapacity = 1)
{
private Tuple<T, int>[] heap = new Tuple<T, int>[startCapacity];
public int CurrentCapacity = startCapacity;

Choose a reason for hiding this comment

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

public-полей быть не должно вообще


public class Queue<T>(int startCapacity = 1)
{
private Tuple<T, int>[] heap = new Tuple<T, int>[startCapacity];

Choose a reason for hiding this comment

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

Tuple в современном C# не нужны, есть кортежи

namespace DataStructures;

[System.Serializable]
public class QueueIsEmtpyException : System.Exception

Choose a reason for hiding this comment

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

Suggested change
public class QueueIsEmtpyException : System.Exception
public class QueueIsEmptyException : System.Exception

{
Assert.That(queue.Dequeue, Is.EqualTo(answers[i]));
}
}

Choose a reason for hiding this comment

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

Тестов негусто. В частности, интересно поведение при одинаковых приоритетах

{
if (Empty())
{
throw new QueueIsEmtpyException("Queue is empty");

Choose a reason for hiding this comment

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

Делать эту проверку в Enqueue, очевидно, неправильно :) Из-за неё тесты не проходят.

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.

3 participants