PR1 Done
This commit is contained in:
18
PR1/ConsoleApp1/Calculator.cs
Normal file
18
PR1/ConsoleApp1/Calculator.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Calculator.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -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
|
||||
|
||||
36
USqlCSharpUdoUnitTestProject1/Properties/AssemblyInfo.cs
Normal file
36
USqlCSharpUdoUnitTestProject1/Properties/AssemblyInfo.cs
Normal file
@@ -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")]
|
||||
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{0594675B-CB1E-4F53-B022-A646DB5371BF}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>USqlCSharpUdoUnitTestProject1</RootNamespace>
|
||||
<AssemblyName>USqlCSharpUdoUnitTestProject1</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{4D4E14FB-86F2-46A5-8BFB-41569A68D9E8};{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>USqlCSharpUdoUnitTest</TestProjectType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.Analytics.Interfaces" />
|
||||
<Reference Include="Microsoft.Analytics.Interfaces.Streaming" />
|
||||
<Reference Include="Microsoft.Analytics.Types" />
|
||||
<Reference Include="Microsoft.Analytics.UnitTest" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="UnitTest1.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PR1\ConsoleApp1\PR1.csproj">
|
||||
<Project>{c8dc9f69-67cd-4dca-8eb3-cbcb3709f26d}</Project>
|
||||
<Name>PR1</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
187
USqlCSharpUdoUnitTestProject1/UnitTest1.cs
Normal file
187
USqlCSharpUdoUnitTestProject1/UnitTest1.cs
Normal file
@@ -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;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user