<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ExpressionToCodeLib;
using NUnit.Framework;

namespace ExpressionToCodeTest {
	[TestFixture]
	public class ImplicitCastingTest {
		[Test]
		public void CharNoCast() {
			Assert.AreEqual(
				@"() => ""abc""[1] == 'b'",
				ExpressionToCode.ToCode(() => "abc"[1] == 'b'));
		}

		[Test]
		public void StringsImplicitCast() {
			var i = 1;
			var x = "X";
			Assert.AreEqual(
				@"() => ((""a\n\\b"" ?? x) + x).Length == 2 ? false : true && (1m + -i > 0 || false)",
				ExpressionToCode.ToCode(() => (("a\n\\b" ?? x) + x).Length == 2 ? false : true && (1m + -i > 0 || false)));
		}

		[Test]
		public void NotImplicitCast() {
			byte z = 42;<commit_msg>More test cleanups; add test cases for inferred char constants.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ExpressionToCodeLib;
using NUnit.Framework;

namespace ExpressionToCodeTest {
	[TestFixture]
	public class ImplicitCastingTest {
		[Test]
		public void CharNoCast() {
			Assert.AreEqual(
				@"() => ""abc""[1] == 'b'",
				ExpressionToCode.ToCode(() => "abc"[1] == 'b'));
		}

		[Test]
		public void CharComp() {
			var c = 'c';
			Assert.AreEqual(
				@"() => c == 'b'",
				ExpressionToCode.ToCode(() => c == 'b'));
		}


		[Test, Ignore("issue 4")]
		public void DecimalImplicitCast() {
			var i = 1;
			var x = "X";
			Assert.AreEqual(
				@"() => (1m + -i > 0 || false)",
				ExpressionToCode.ToCode(() => (1m + -i > 0 || false)));
		}


		[Test, Ignore("issue 4")]
		public void StringImplicitConcat() {
			var i = 1;
			var x = "X";
			Assert.AreEqual(
				@"() => 1m + x + ""!!"" + i)",
				ExpressionToCode.ToCode(() => 1m + x + "!!" + i));
		}

		[Test, Ignore("issue 4")]
		public void NotImplicitCast() {
			byte z = 42;
{'fraction_non_alphanumeric': 0.19871106337271752, 'fraction_numerical': 0.013963480128893663, 'mean_word_length': 3.272935779816514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2262221', 'n_tokens_mistral': 790, 'n_tokens_neox': 673, 'n_words': 167}