Skip to content

Lzw - #7

Open
Palezehvat wants to merge 16 commits into
masterfrom
LZW
Open

Lzw#7
Palezehvat wants to merge 16 commits into
masterfrom
LZW

Conversation

@Palezehvat

Copy link
Copy Markdown
Owner

lzw

@yurii-litvinov yurii-litvinov left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment thread 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();

Copy link
Copy Markdown

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();

Comment thread 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment thread LZW/LZW/Bor.cs
{
if (root == null || buffer == null)
{
throw new InvalidOperationException();

Copy link
Copy Markdown

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))

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

Copy link
Copy Markdown

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)

Comment thread LZW/TestLZW/TestLZW.cs Outdated
var (isCorrect, _) = lzw.LzwAlgorithm(Path.Combine(TestContext.CurrentContext.TestDirectory, "TestsForLZW", "testAnElementaryExample.txt"), "-c");
if (!isCorrect )
{
Assert.Fail();

Copy link
Copy Markdown

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

Comment thread LZW/TestLZW/TestLZW.cs Outdated
}
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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment thread LZW/TestsBor/TestsBor.cs
Comment on lines +3 to +4
using Bor;
public class TestsForBor

Copy link
Copy Markdown

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

Comment thread LZW/TestsBor/TestsBor.cs Outdated
using Bor;
public class TestsForBor
{
Bor bor;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment thread LZW/TestsBor/TestsBor.cs
[TestCaseSource(nameof(BorForTests))]
public void TheAddedElementShouldbeFoundInBor(Bor bor)
{
Setup();

Copy link
Copy Markdown

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