diff --git a/PR1/ConsoleApp1/Calculator.cs b/PR1/ConsoleApp1/Calculator.cs new file mode 100644 index 0000000..749e59f --- /dev/null +++ b/PR1/ConsoleApp1/Calculator.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp1 +{ + public class Calculator + { + public double Addiction(double x, double y) => x + y; + public double Subtraction(double x, double y) => x - y; + public double Multipliction(double x, double y) => x * y; + public double Division(double x, double y) => x / y; + public long Multipliction(long x, long y) => x * y; + public long Addiction(long x, long y) => x + y; + } +} diff --git a/PR1/ConsoleApp1/PR1.csproj b/PR1/ConsoleApp1/PR1.csproj index bda6dc1..6c2fc8d 100644 --- a/PR1/ConsoleApp1/PR1.csproj +++ b/PR1/ConsoleApp1/PR1.csproj @@ -43,6 +43,7 @@ + diff --git a/PR1/PR1.sln b/PR1/PR1.sln index c23ff7c..9f1fc41 100644 --- a/PR1/PR1.sln +++ b/PR1/PR1.sln @@ -1,10 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.13.35919.96 d17.13 +VisualStudioVersion = 17.13.35919.96 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PR1", "ConsoleApp1\PR1.csproj", "{C8DC9F69-67CD-4DCA-8EB3-CBCB3709F26D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "USqlCSharpUdoUnitTestProject1", "..\USqlCSharpUdoUnitTestProject1\USqlCSharpUdoUnitTestProject1.csproj", "{0594675B-CB1E-4F53-B022-A646DB5371BF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {C8DC9F69-67CD-4DCA-8EB3-CBCB3709F26D}.Debug|Any CPU.Build.0 = Debug|Any CPU {C8DC9F69-67CD-4DCA-8EB3-CBCB3709F26D}.Release|Any CPU.ActiveCfg = Release|Any CPU {C8DC9F69-67CD-4DCA-8EB3-CBCB3709F26D}.Release|Any CPU.Build.0 = Release|Any CPU + {0594675B-CB1E-4F53-B022-A646DB5371BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0594675B-CB1E-4F53-B022-A646DB5371BF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0594675B-CB1E-4F53-B022-A646DB5371BF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0594675B-CB1E-4F53-B022-A646DB5371BF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/USqlCSharpUdoUnitTestProject1/Properties/AssemblyInfo.cs b/USqlCSharpUdoUnitTestProject1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..93f0140 --- /dev/null +++ b/USqlCSharpUdoUnitTestProject1/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("USqlCSharpUdoUnitTestProject1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("HP Inc.")] +[assembly: AssemblyProduct("USqlCSharpUdoUnitTestProject1")] +[assembly: AssemblyCopyright("Copyright © HP Inc. 2026")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("0594675b-cb1e-4f53-b022-a646db5371bf")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/USqlCSharpUdoUnitTestProject1/USqlCSharpUdoUnitTestProject1.csproj b/USqlCSharpUdoUnitTestProject1/USqlCSharpUdoUnitTestProject1.csproj new file mode 100644 index 0000000..6b75463 --- /dev/null +++ b/USqlCSharpUdoUnitTestProject1/USqlCSharpUdoUnitTestProject1.csproj @@ -0,0 +1,94 @@ + + + + + Debug + AnyCPU + {0594675B-CB1E-4F53-B022-A646DB5371BF} + Library + Properties + USqlCSharpUdoUnitTestProject1 + USqlCSharpUdoUnitTestProject1 + v4.8 + 512 + {4D4E14FB-86F2-46A5-8BFB-41569A68D9E8};{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + USqlCSharpUdoUnitTest + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + {c8dc9f69-67cd-4dca-8eb3-cbcb3709f26d} + PR1 + + + + + + + False + + + False + + + False + + + False + + + + + + + + \ No newline at end of file diff --git a/USqlCSharpUdoUnitTestProject1/UnitTest1.cs b/USqlCSharpUdoUnitTestProject1/UnitTest1.cs new file mode 100644 index 0000000..dcb81d2 --- /dev/null +++ b/USqlCSharpUdoUnitTestProject1/UnitTest1.cs @@ -0,0 +1,187 @@ +using ConsoleApp1; +using Microsoft.Analytics.Interfaces; +using Microsoft.Analytics.Interfaces.Streaming; +using Microsoft.Analytics.Types.Sql; +using Microsoft.Analytics.UnitTest; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using PR1; +using System.Numerics; + +namespace USqlCSharpUdoUnitTestProject1 +{ + [TestClass] + public class UnitTest1 + { + Calculator Calculator1 = new Calculator(); + public UnitTest1() + { + // + // TODO: Add constructor logic here + // + } + + private TestContext testContextInstance; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + public TestContext TestContext + { + get + { + return testContextInstance; + } + set + { + testContextInstance = value; + } + } + + #region Additional test attributes + // + // You can use the following additional attributes as you write your tests: + // + // Use ClassInitialize to run code before running the first test in the class + // [ClassInitialize()] + // public static void MyClassInitialize(TestContext testContext) { } + // + // Use ClassCleanup to run code after all tests in a class have run + // [ClassCleanup()] + // public static void MyClassCleanup() { } + // + // Use TestInitialize to run code before running each test + // [TestInitialize()] + // public void MyTestInitialize() { } + // + // Use TestCleanup to run code after each test has run + // [TestCleanup()] + // public void MyTestCleanup() { } + // + #endregion + + [TestMethod] + public void TestMethod1() + { + double x = 2; + double y = 5; + + double result1 = 7; + double result2 = -3; + double result3 = 10; + double result4 = 0.4; + + Assert.AreEqual(Calculator1.Addiction(x, y), result1); + Assert.AreEqual(Calculator1.Subtraction(x, y), result2); + Assert.AreEqual(Calculator1.Multipliction(x, y), result3); + Assert.AreEqual(Calculator1.Division(x, y), result4); + } + [TestMethod] + public void TestMethod2() + { + double x = -2; + double y = -5; + + double result1 = -7; + double result2 = 3; + double result3 = 10; + double result4 = 0.4; + + Assert.AreEqual(Calculator1.Addiction(x, y), result1); + Assert.AreEqual(Calculator1.Subtraction(x, y), result2); + Assert.AreEqual(Calculator1.Multipliction(x, y), result3); + Assert.AreEqual(Calculator1.Division(x, y), result4); + } + [TestMethod] + public void TestMethod3() + { + double x = 2.5; + double y = 3.6; + + double result1 = 6.1; + double result2 = -1.1; + double result3 = 9; + double result4 = 0.69444444444444444444444444444444; + + Assert.AreEqual(Calculator1.Addiction(x, y), result1); + Assert.AreEqual(Calculator1.Subtraction(x, y), result2); + Assert.AreEqual(Calculator1.Multipliction(x, y), result3); + Assert.AreEqual(Calculator1.Division(x, y), result4); + } + [TestMethod] + public void TestMethod4() + { + double x = 4; + double y = 1; + + double result = 4; + + + Assert.AreEqual(Calculator1.Division(x, y), result); + } + [TestMethod] + public void TestMethod5() + { + double x = 4; + double y = 0; + + double result = double.PositiveInfinity; + + + Assert.AreEqual(Calculator1.Division(x, y), result); + } + [TestMethod] + public void TestMethod6() + { + double x = int.MaxValue; + double y = int.MaxValue; + + double result1 = 4294967294; + double result2 = 0; + double result3 = 4611686014132420609; + double result4 = 1; + + Assert.AreEqual(Calculator1.Addiction(x, y), result1); + Assert.AreEqual(Calculator1.Subtraction(x, y), result2); + Assert.AreEqual(Calculator1.Multipliction(x, y), result3); + Assert.AreEqual(Calculator1.Division(x, y), result4); + } + [TestMethod] + public void TestMethod7() + { + long x = int.MaxValue; + long y = int.MaxValue; + + double result1 = 4294967294; + double result2 = 0; + double result3 = 4611686014132420609L; + double result4 = 1; + + Assert.AreEqual(Calculator1.Addiction(x, y), result1); + Assert.AreEqual(Calculator1.Subtraction(x, y), result2); + Assert.AreEqual(Calculator1.Multipliction(x, y), result3); + Assert.AreEqual(Calculator1.Division(x, y), result4); + } + [TestMethod] + public void TestMethod8() + { + double x = 2.5; + double y = 3.6; + + double result1 = 6.1; + double result2 = -1.1; + double result3 = 9; + double result4 = 0.69444444444444444444444444444444; + + Assert.AreEqual(Calculator1.Addiction(x, y), result1); + Assert.AreEqual(Calculator1.Subtraction(x, y), result2); + Assert.AreEqual(Calculator1.Multipliction(x, y), result3); + Assert.AreEqual(Calculator1.Division(x, y), result4); + } + } +}