Infineon.EAF.Runtime v2.59.0
With .gitignore *.traineddata
This commit is contained in:
131
Adaptation/_Tests/Static/jpeg.cs
Normal file
131
Adaptation/_Tests/Static/jpeg.cs
Normal file
@ -0,0 +1,131 @@
|
||||
using Adaptation._Tests.Shared;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation._Tests.Static;
|
||||
|
||||
[TestClass]
|
||||
public class JPEG : LoggingUnitTesting, IDisposable
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
internal static JPEG LoggingUnitTesting { get; private set; }
|
||||
|
||||
public JPEG() : base(testContext: null, declaringType: null)
|
||||
{
|
||||
if (LoggingUnitTesting is null)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
public JPEG(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType)
|
||||
{
|
||||
}
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext) => LoggingUnitTesting ??= new JPEG(testContext);
|
||||
|
||||
[ClassCleanup()]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
LoggingUnitTesting?.Logger?.LogInformation("Cleanup");
|
||||
LoggingUnitTesting?.Dispose();
|
||||
}
|
||||
|
||||
private static void NonThrowTryCatch()
|
||||
{
|
||||
try
|
||||
{ throw new Exception(); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void TestDescriptor()
|
||||
{
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
string fileName = "D:/Tmp/phares/R53-EQPT_638005905604624544 - Run Wafer.jpeg";
|
||||
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
// (float pageMeanConfidence, string text, List<string> blocks) = FileHandlers.jpeg.ProcessData.Parse(fileName, new(), 0, 0, 0, 0, 0, 0);
|
||||
List<(float pageMeanConfidence, string text, List<string> blocks)> collection = FileHandlers.jpeg.ProcessData.Parse(fileName);
|
||||
Assert.IsTrue(collection.Count != 0);
|
||||
foreach ((float pageMeanConfidence, string text, List<string> blocks) in collection)
|
||||
{
|
||||
Assert.IsTrue(pageMeanConfidence > 0);
|
||||
Assert.IsTrue(!string.IsNullOrEmpty(text));
|
||||
Assert.IsTrue(blocks.Count != 0);
|
||||
// Normal images
|
||||
// "RECIPE:\nte end\nte a ee)\nAcne\n"
|
||||
// Grayscale
|
||||
// "RECIPE:\nEee en\nRECIPE e943\n\ncera ke\n"
|
||||
// Grayscale Inverted
|
||||
// "RECIPE:\nOT6_10PH. 60.3.0\nRECIPE e943\nASgMe\n"
|
||||
// BW
|
||||
// "RECIPE\nCTG.}0PH. 60.3.0\nRECIPE #943\nAGM e\n"
|
||||
}
|
||||
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Production()
|
||||
{
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
StringBuilder results = new();
|
||||
(string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[]
|
||||
{
|
||||
new("R34", "v2.59.0"),
|
||||
new("R53", "v2.59.0"),
|
||||
new("R55", "v2.59.0"),
|
||||
new("R34-EQPT", "v2.59.0"),
|
||||
new("R53-EQPT", "v2.59.0"),
|
||||
new("R55-EQPT", "v2.59.0"),
|
||||
};
|
||||
string production = "http://messa08ec.infineon.com:9003/CellInstanceServiceV2";
|
||||
Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion;
|
||||
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
foreach ((string cellInstanceName, string cellInstanceVersionName) in collection)
|
||||
{
|
||||
cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{production}/{cellInstanceName}/{cellInstanceVersionName}/configuration");
|
||||
_ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}");
|
||||
}
|
||||
string sourceDirectory = "D:/Tmp/cellInstanceVersion.EdaConnection.PortNumber";
|
||||
if (!Directory.Exists(sourceDirectory))
|
||||
_ = Directory.CreateDirectory(sourceDirectory);
|
||||
File.WriteAllText(Path.Combine(sourceDirectory, $"{methodBase.Module.Name}-{methodBase.ReflectedType.Name}-{methodBase.Name}.tsv"), results.ToString());
|
||||
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CellInstanceVersionEdaConnectionPortNumber()
|
||||
{
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
string sourceDirectory = "D:/Tmp/cellInstanceVersion.EdaConnection.PortNumber";
|
||||
if (Directory.Exists(sourceDirectory))
|
||||
{
|
||||
string destinationDirectory = Path.Combine(sourceDirectory, "All");
|
||||
if (!Directory.Exists(destinationDirectory))
|
||||
_ = Directory.CreateDirectory(destinationDirectory);
|
||||
List<string> lines = new();
|
||||
string[] files = Directory.GetFiles(sourceDirectory, "*.tsv", SearchOption.TopDirectoryOnly);
|
||||
foreach (string file in files)
|
||||
lines.AddRange(File.ReadAllLines(file));
|
||||
File.WriteAllLines(Path.Combine(destinationDirectory, $"{DateTime.Now.Ticks}.tsv"), lines.Distinct().OrderBy(l => l));
|
||||
}
|
||||
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user