diff options
author | Pat Gavlin <pagavlin@microsoft.com> | 2015-12-04 14:22:14 -0800 |
---|---|---|
committer | Pat Gavlin <pagavlin@microsoft.com> | 2015-12-04 15:57:25 -0800 |
commit | d999a0aa9df21107e213f1c491b8961838e47a2e (patch) | |
tree | 83878ac83ddac7b33ec7669f0eb122abe1576a76 /tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics040.cs | |
parent | 4feb6c40dd4d60783b54d8b58431bf069c143796 (diff) | |
download | coreclr-d999a0aa9df21107e213f1c491b8961838e47a2e.tar.gz coreclr-d999a0aa9df21107e213f1c491b8961838e47a2e.tar.bz2 coreclr-d999a0aa9df21107e213f1c491b8961838e47a2e.zip |
Import jit/jit64/valuetype/nullable tests.
This includes box/unbox and cast tests. There is also a small change
to jit/config/minimal/project.json to include
the System.Runtime.InteropServices package.
Diffstat (limited to 'tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics040.cs')
-rw-r--r-- | tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics040.cs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics040.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics040.cs new file mode 100644 index 0000000000..7c2fcfcc08 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics040.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ImplementOneInterfaceGen<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((ImplementOneInterfaceGen<int>)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((ImplementOneInterfaceGen<int>?)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>))); + } + + private static int Main() + { + ImplementOneInterfaceGen<int>? s = Helper.Create(default(ImplementOneInterfaceGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + |