iced/Iced.UnitTests/Intel/EncoderTests/EncoderTest_Invalid.cs

46 lines
1.8 KiB
C#
Raw Normal View History

2018-09-06 02:02:48 +02:00
/*
Copyright (C) 2018 de4dot@gmail.com
This file is part of Iced.
Iced is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Iced is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Iced. If not, see <https://www.gnu.org/licenses/>.
*/
#if !NO_ENCODER
using System.Collections.Generic;
using Iced.Intel;
using Iced.UnitTests.Intel.DecoderTests;
using Xunit;
namespace Iced.UnitTests.Intel.EncoderTests {
public sealed class EncoderTest_Invalid : EncoderTest {
[Theory]
[MemberData(nameof(EncodeInvalid_Data))]
2018-09-25 21:26:05 +02:00
void EncodeInvalid(int codeSize, Code code, string hexBytes, DecoderOptions options, int invalidCodeSize) => EncodeInvalidBase(codeSize, code, hexBytes, options, invalidCodeSize);
2018-09-06 02:02:48 +02:00
public static IEnumerable<object[]> EncodeInvalid_Data {
get {
foreach (var info in DecoderTestUtils.GetDecoderTests(needHexBytes: true, includeOtherTests: false)) {
if (DecoderTestUtils.Code32Only.Contains(info.Code))
2018-09-25 21:26:05 +02:00
yield return new object[] { info.Bitness, info.Code, info.HexBytes, info.Options, 64 };
2018-09-06 02:02:48 +02:00
if (DecoderTestUtils.Code64Only.Contains(info.Code)) {
2018-09-25 21:26:05 +02:00
yield return new object[] { info.Bitness, info.Code, info.HexBytes, info.Options, 16 };
yield return new object[] { info.Bitness, info.Code, info.HexBytes, info.Options, 32 };
2018-09-06 02:02:48 +02:00
}
}
}
}
}
}
#endif