From d8fdf14ec75bb089e115023ac7f8a66b6c173727 Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Tue, 26 Jul 2022 01:30:36 -0400 Subject: [PATCH] format docs, move comments around --- BenchtopParser/I28.cs | 4 +--- BenchtopParser/ProgramConfig.cs | 10 ++++++---- BenchtopParser/TransducerVerify.cs | 6 +++--- BenchtopParserTests/Program_Config_Tests.cs | 6 +++--- BenchtopParserTests/Transducer_Verify_Tests.cs | 1 - 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/BenchtopParser/I28.cs b/BenchtopParser/I28.cs index 34f4397..87dd6b2 100644 --- a/BenchtopParser/I28.cs +++ b/BenchtopParser/I28.cs @@ -12,6 +12,4 @@ namespace BenchtopParser { return tv; } } -} - -// TODO: normalize snake or pascal case \ No newline at end of file +} \ No newline at end of file diff --git a/BenchtopParser/ProgramConfig.cs b/BenchtopParser/ProgramConfig.cs index 1f1c2d9..1bc25f6 100644 --- a/BenchtopParser/ProgramConfig.cs +++ b/BenchtopParser/ProgramConfig.cs @@ -47,22 +47,24 @@ namespace BenchtopParser { public class Configuration { public String? name { get; set; } public String? value { get; set; } - public String? type { get; set; } public String? unit { get; set; } + public String? type { get; set; } //possible values are: a, c, f, i. Which I presume are Array, Characters, Float, Integer + + public Configuration(List config, String data) { String[] nameValue = data.Split("="); name = nameValue[0].Trim(); value = nameValue[1].Trim(); unit = config[1].Trim(); - type = config[2].Trim(); //a, c, f, i + type = config[2].Trim(); } } public class ProgramConfig { public Dictionary programs = new Dictionary(); - public ProgramConfig (String program_config_value) { + public ProgramConfig(String program_config_value) { Program? current = null; foreach (var line in program_config_value.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) { @@ -119,5 +121,5 @@ namespace BenchtopParser { } } - + } diff --git a/BenchtopParser/TransducerVerify.cs b/BenchtopParser/TransducerVerify.cs index cc0b39d..d29bd2b 100644 --- a/BenchtopParser/TransducerVerify.cs +++ b/BenchtopParser/TransducerVerify.cs @@ -13,7 +13,7 @@ namespace BenchtopParser { /// Split the string, and clean up whitespace, returns the Name and Value public String[] SplitLine(String line) { - return new[] { + return new[] { line[..indent].TrimEnd(), line[(indent + 1)..] }; @@ -23,7 +23,7 @@ namespace BenchtopParser { var restOfLine = line.Substring(endOfCurrentTransducerKey); var additionalSpaces = restOfLine.TakeWhile(c => c == ' ').Count(); // length 1 based, remove 1, then add additional spaces - this.indent = endOfCurrentTransducerKey - 1 + additionalSpaces; + this.indent = endOfCurrentTransducerKey - 1 + additionalSpaces; } public TransducerVerify(String transducer_verify_value) { @@ -84,6 +84,6 @@ namespace BenchtopParser { public Transducer(int id) { this.id = id; } - + } } diff --git a/BenchtopParserTests/Program_Config_Tests.cs b/BenchtopParserTests/Program_Config_Tests.cs index 5319204..84cce74 100644 --- a/BenchtopParserTests/Program_Config_Tests.cs +++ b/BenchtopParserTests/Program_Config_Tests.cs @@ -4,9 +4,9 @@ namespace BenchtopParserTests { [SetUp] public void Setup() { - program_config_value = File.ReadAllText( - Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestFiles\Program Config.txt") - ); + program_config_value = File.ReadAllText( + Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestFiles\Program Config.txt") + ); } [Test] diff --git a/BenchtopParserTests/Transducer_Verify_Tests.cs b/BenchtopParserTests/Transducer_Verify_Tests.cs index cda1da9..54defc0 100644 --- a/BenchtopParserTests/Transducer_Verify_Tests.cs +++ b/BenchtopParserTests/Transducer_Verify_Tests.cs @@ -15,7 +15,6 @@ namespace BenchtopParserTests { Assert.That(tv.transducers[1].name, Is.EqualTo("CTS D34-442 115PSIA")); } - [Test] public void Test_TransducerVerify_Throw_InvalidProgram() { Exception ex = Assert.Throws(delegate { BenchtopParser.I28.Load_TransducerVerify("broken"); });