Skip to content

Lzw#7

Open
Palezehvat wants to merge 16 commits intomasterfrom
LZW
Open

Lzw#7
Palezehvat wants to merge 16 commits intomasterfrom
LZW

Conversation

@Palezehvat
Copy link
Owner

lzw

Copy link

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

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

Сжал/разжал, получил из .txt .exe-шник :) Вообще, файлы бывают не только .txt и .exe, а ещё бывают файлы без расширения вовсе, и их тоже иногда хочется сжимать.

LZW/LZW/Bor.cs Outdated
@@ -0,0 +1,119 @@
namespace Bor;

// A container for storing strings, in the form of a suspended tree

Choose a reason for hiding this comment

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

В этой задаче уже надо было комментарии в формате XML Documentation

LZW/LZW/Bor.cs Outdated
// A container for storing strings, in the form of a suspended tree
public class Bor
{
private BorElement root = new BorElement();

Choose a reason for hiding this comment

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

Suggested change
private BorElement root = new BorElement();
private BorElement root = new();

LZW/LZW/Bor.cs Outdated
private BorElement root = new BorElement();

// Adding an element
public (bool, int) Add(Bor bor, char[] buffer, int from, int to)

Choose a reason for hiding this comment

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

Что за bor и бывает ли он отличным от this?

{
if (root == null || buffer == null)
{
throw new InvalidOperationException();

Choose a reason for hiding this comment

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

Если buffer null, надо кидать ArgumentNullException(nameof(buffer))

LZW/LZW/Bor.cs Outdated
pointer++;
i++;
}
if (walker.IsTerminal == false)

Choose a reason for hiding this comment

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

Suggested change
if (walker.IsTerminal == false)
if (!walker.IsTerminal)

var (isCorrect, _) = lzw.LzwAlgorithm(Path.Combine(TestContext.CurrentContext.TestDirectory, "TestsForLZW", "testAnElementaryExample.txt"), "-c");
if (!isCorrect )
{
Assert.Fail();

Choose a reason for hiding this comment

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

Не пользуйтесь Assert.Fail, пользуйтесь Assert.AreEqual или, лучше, Assert.That

}
string correctText = File.ReadAllText(Path.Combine(TestContext.CurrentContext.TestDirectory, "TestsForLZW", "testAnElementaryExample.txt"));
string fromLZWText = File.ReadAllText(Path.Combine(TestContext.CurrentContext.TestDirectory, "TestsForLZW", "testAnElementaryExample.exe"));
Assert.True(correctText == fromLZWText);

Choose a reason for hiding this comment

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

Так тоже нельзя, из-за невнятного сообщения об ошибке при непроходящем тесте. Пользуйтесь Assert.That

Comment on lines 3 to 4
using Bor;
public class TestsForBor

Choose a reason for hiding this comment

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

Suggested change
using Bor;
public class TestsForBor
using Bor;
public class TestsForBor

using Bor;
public class TestsForBor
{
Bor bor;

Choose a reason for hiding this comment

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

Тут тоже надо модификатор видимости и пустую строку

[TestCaseSource(nameof(BorForTests))]
public void TheAddedElementShouldbeFoundInBor(Bor bor)
{
Setup();

Choose a reason for hiding this comment

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

И тут, и ниже надо поправить

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

Comments