diff --git a/appveyor.yml b/appveyor.yml
index 855f34f..d911de9 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,7 +1,18 @@
-image: Visual Studio 2017
+
+image: Visual Studio 2019
+
+init:
+ - git config --global core.autocrlf true
+
+environment:
+ matrix:
+ - solution: Semester4/BracketsChecker/BracketsChecker.sln
before_build:
- - nuget restore semester2/6.1/HW6T2.sln
+ - nuget restore %solution%
build:
- project: semester2/2.3/2.3.sln
+ project: $(solution)
+
+test_script:
+ - dotnet test %solution%
diff --git a/semester4/BracketsChecker/BracketsCheckTests/BracketsCheckTests.fsproj b/semester4/BracketsChecker/BracketsCheckTests/BracketsCheckTests.fsproj
new file mode 100644
index 0000000..8333a77
--- /dev/null
+++ b/semester4/BracketsChecker/BracketsCheckTests/BracketsCheckTests.fsproj
@@ -0,0 +1,27 @@
+
+
+
+ netcoreapp3.1
+
+ false
+ false
+ TestProject1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/semester4/BracketsChecker/BracketsCheckTests/BracketsCheckerTests.fs b/semester4/BracketsChecker/BracketsCheckTests/BracketsCheckerTests.fs
new file mode 100644
index 0000000..1474b3d
--- /dev/null
+++ b/semester4/BracketsChecker/BracketsCheckTests/BracketsCheckerTests.fs
@@ -0,0 +1,33 @@
+module TestProject1
+
+
+open NUnit.Framework
+open FsUnit
+open BracketsChecker
+
+let cases =
+ [
+ "()", true
+ "[]", true
+ "{}", true
+ "", true
+ "1", true
+ ")(", false
+ "(]", false
+ "([{[]}])", true
+ "[])", false
+ "[[]]", true
+ "[1]", true
+ "([)]", false
+ "(123)", true
+ "]", false
+ "(", false
+ "(1)", true
+ "[453]", true
+ "[23}", false
+ ] |> List.map (fun (string, result) -> TestCaseData(string, result))
+
+[]
+[]
+let bracketsTest str res =
+ bracketsChecker str |> should equal res
\ No newline at end of file
diff --git a/semester4/BracketsChecker/BracketsCheckTests/Program.fs b/semester4/BracketsChecker/BracketsCheckTests/Program.fs
new file mode 100644
index 0000000..0695f84
--- /dev/null
+++ b/semester4/BracketsChecker/BracketsCheckTests/Program.fs
@@ -0,0 +1 @@
+module Program = let [] main _ = 0
diff --git a/semester4/BracketsChecker/BracketsChecker.sln b/semester4/BracketsChecker/BracketsChecker.sln
new file mode 100644
index 0000000..a83a304
--- /dev/null
+++ b/semester4/BracketsChecker/BracketsChecker.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "BracketsChecker", "BracketsChecker\BracketsChecker.fsproj", "{8751A404-2E55-4DBA-AC3E-6C90466F861F}"
+EndProject
+Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "BracketsCheckTests", "BracketsCheckTests\BracketsCheckTests.fsproj", "{779136A1-1CC6-402A-A881-99A8E4337227}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8751A404-2E55-4DBA-AC3E-6C90466F861F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8751A404-2E55-4DBA-AC3E-6C90466F861F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8751A404-2E55-4DBA-AC3E-6C90466F861F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8751A404-2E55-4DBA-AC3E-6C90466F861F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {779136A1-1CC6-402A-A881-99A8E4337227}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {779136A1-1CC6-402A-A881-99A8E4337227}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {779136A1-1CC6-402A-A881-99A8E4337227}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {779136A1-1CC6-402A-A881-99A8E4337227}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/semester4/BracketsChecker/BracketsChecker/BracketsChecker.fs b/semester4/BracketsChecker/BracketsChecker/BracketsChecker.fs
new file mode 100644
index 0000000..3b1b0ee
--- /dev/null
+++ b/semester4/BracketsChecker/BracketsChecker/BracketsChecker.fs
@@ -0,0 +1,36 @@
+module BracketsChecker
+
+open System
+
+/// Сhecks that the parentheses are correctly placed in the expression
+let bracketsChecker (str : String) =
+ let isNotBracket (ch : Char) =
+ ch <> '[' && ch <> '{' && ch <> '(' && ch <> ']' && ch <> '}' && ch <> ')'
+
+ /// Checks if symbol is a opening bracket
+ let isOpenBracket (bracket : Char) =
+ bracket = '[' || bracket = '{' || bracket = '('
+
+ /// Checks if symbols are opening and closing brackets of the same type
+ let isMatchingBrackets (first : Char) (second : Char) =
+ match first with
+ | '(' -> second = ')'
+ | '[' -> second = ']'
+ | '{' -> second = '}'
+ | _ -> true
+
+ /// Checks if brackets in line are correct
+ let rec checkLine (str : List) (memory : List) =
+ if str = []
+ then memory = []
+ else
+ let current = List.head str
+ if (isNotBracket current) then
+ checkLine (List.tail str) (memory)
+ elif (isOpenBracket current) then
+ checkLine (List.tail str) (current :: memory)
+ elif (memory <> [] && isMatchingBrackets (List.head memory) (current)) then
+ checkLine (List.tail str) (List.tail memory)
+ else false
+
+ checkLine (Seq.toList str) []
\ No newline at end of file
diff --git a/semester4/BracketsChecker/BracketsChecker/BracketsChecker.fsproj b/semester4/BracketsChecker/BracketsChecker/BracketsChecker.fsproj
new file mode 100644
index 0000000..d540876
--- /dev/null
+++ b/semester4/BracketsChecker/BracketsChecker/BracketsChecker.fsproj
@@ -0,0 +1,11 @@
+
+
+
+ netcoreapp3.1
+
+
+
+
+
+
+