Skip to content

Commit

Permalink
add platform property (#215)
Browse files Browse the repository at this point in the history
* add platform property

fix assignment error

* add bench, add methods to safehandle

* replace c interface uses of size_t with uint64_t

* clean up uses of long in c# classes

* fix a few missed size_t

* missed another one

* explicitly state calling convention for native api's

* fix compiler warnings

* add a targets file and explicitly place package output

* do not error on old style cast

* fix typo
  • Loading branch information
AddressXception authored Oct 25, 2021
1 parent a29c8b4 commit e9803d0
Show file tree
Hide file tree
Showing 30 changed files with 1,338 additions and 801 deletions.
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all build build-msvc build-android build-ios clean environment format memcheck sanitize sanitize-asan sanitize-tsan test test-msvc test-netstandard
.PHONY: all build build-msvc build-android build-ios clean clean-netstandard environment format memcheck sanitize sanitize-asan sanitize-tsan test test-msvc test-netstandard

.EXPORT_ALL_VARIABLES:
ELECTIONGUARD_BUILD_DIR=$(realpath .)/build
Expand Down Expand Up @@ -166,8 +166,9 @@ else
make build
endif

@echo 🖥️ BUILD NETSTANDARD
@echo 🖥️ BUILD NETSTANDARD
dotnet build --configuration $(TARGET) ./bindings/netstandard/ElectionGuard/ElectionGuard.sln
dotnet build --configuration $(TARGET) ./bindings/netstandard/ElectionGuard/ElectionGuard.sln /property:Platform=x86

clean:
@echo 🗑️ Cleaning Output Directory
Expand All @@ -187,6 +188,10 @@ else
if [ ! -d "$(ELECTIONGUARD_BUILD_LIBS_DIR)/ios" ]; then mkdir $(ELECTIONGUARD_BUILD_LIBS_DIR)/ios; fi
endif

clean-netstandard:
@echo 🗑️ CLEAN NETSTANDARD
dotnet clean ./bindings/netstandard/ElectionGuard/ElectionGuard.sln

format: build
cd $(ELECTIONGUARD_BUILD_LIBS_DIR)/x86_64 && $(MAKE) format

Expand Down Expand Up @@ -343,6 +348,7 @@ endif
test-netstandard: build-netstandard
@echo 🧪 TEST NETSTANDARD
dotnet test --configuration $(TARGET) ./bindings/netstandard/ElectionGuard/ElectionGuard.sln
dotnet test --configuration $(TARGET) ./bindings/netstandard/ElectionGuard/ElectionGuard.sln /property:Platform=x86

coverage:
@echo ✅ CHECK COVERAGE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ElectionGuard.Encryption.Bench
{
class BenchManifest
{
public static bool Bench_Can_Construct_Internationalized_Text()
{
Stopwatch sw = new Stopwatch();
sw.Start();
// Arrange
var language_1 = new Language("some words", "en");
var language_2 = new Language("algunas palabras", "es");
var languages = new[] { language_1, language_2 };

// Act
var subject = new InternationalizedText(languages);

// Assert
var actual = subject.GetTextAt(0);
Console.WriteLine($"actual.Value: {actual.Value}");
sw.Stop();
Console.WriteLine("Elapsed={0}", sw.Elapsed);
return true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ class Program
{
static void Main(string[] args)
{
Console.WriteLine("benchmarking");

BenchEncrypt.Bench_Encrypt_Ballot_Simple();
BenchManifest.Bench_Can_Construct_Internationalized_Text();

Console.WriteLine("done! press any key to exit");

Console.ReadKey();
}
}
}
Loading

0 comments on commit e9803d0

Please sign in to comment.