Skip to content

Instantly share code, notes, and snippets.

View heathbm's full-sized avatar

Heath Baron-Morgan heathbm

View GitHub Profile
@heathbm
heathbm / Base64DecodingTests.cs
Last active December 7, 2022 07:51
The `Base64` decoding methods should handle whitespace chars as the `Convert.ToBase64` decoding methods. This should test 100,000s of unique base64 strings with white space chars inserted into every possible index, and multiple indexes at once, in strings ranging from 1 to 70 chars long.
using System.Buffers;
using System.Buffers.Text;
using System.Text;
public static class Base64DecodingTests
{
public static void Testing()
{
ReadOnlySpan<char> text = "abcdefghijklmnopqrstuvxyz0123456789abcdefghijklmnopqrstuvxyz0123456789".AsSpan();
@heathbm
heathbm / EnumTryFormatBenchmarks.cs
Last active July 5, 2022 06:25
Enum.TryFormat Benchmarks
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using BenchmarkDotNet.Attributes;
using MicroBenchmarks;
namespace System.Tests
{
[MemoryDiagnoser]
@heathbm
heathbm / EnumTryFormatProfiling.cs
Created July 3, 2022 06:01
Enum.TryFormat Profiling
using System.Runtime.CompilerServices;
namespace ProfilerCoreRun
{
public class Program
{
public enum SimpleEnum
{
Red = 1,
Blue = 2,