WeixiangYan/CodeTransOcean huggingface dataset:
Task: Test a function

C: #include <assert.h>
int IsPalindrome(char *Str);

int main()
{
    assert(IsPalindrome("racecar"));
    assert(IsPalindrome("alice"));
}



C#: using Microsoft.VisualStudio.TestTools.UnitTesting;
using PalindromeDetector.ConsoleApp;

namespace PalindromeDetector.VisualStudioTests
{
    [TestClass]
    public class VSTests
    {
        [TestMethod]
        public void PalindromeDetectorCanUnderstandPalindrome()
        {
            
            bool expected = true;
            bool actual;
            actual = Program.IsPalindrome("1");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindromeNonRecursive("1");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindrome("ingirumimusnocteetconsumimurigni");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindromeNonRecursive("ingirumimusnocteetconsumimurigni");
            Assert.AreEqual(expected, actual);
        }
        [TestMethod]
        public void PalindromeDetecotryCanUnderstandNonPalindrome()
        {
            bool notExpected = true;
            bool actual = Program.IsPalindrome("ThisIsNotAPalindrome");
            Assert.AreNotEqual(notExpected, actual);
            actual = Program.IsPalindromeNonRecursive("ThisIsNotAPalindrome");
            Assert.AreNotEqual(notExpected, actual);
        }
    }
}
Task: Test a function

C: #include <assert.h>
int IsPalindrome(char *Str);

int main()
{
    assert(IsPalindrome("racecar"));
    assert(IsPalindrome("alice"));
}


C++: #include <algorithm>
#include <string>

constexpr bool is_palindrome(std::string_view s)
{
  return std::equal(s.begin(), s.begin()+s.length()/2, s.rbegin());
}
Task: Test a function

C: #include <assert.h>
int IsPalindrome(char *Str);

int main()
{
    assert(IsPalindrome("racecar"));
    assert(IsPalindrome("alice"));
}




Go: package pal

import "testing"

func TestPals(t *testing.T) {
    pals := []string{
        "",
        ".",
        "11",
        "ere",
        "ingirumimusnocteetconsumimurigni",
    }
    for _, s := range pals {
        if !IsPal(s) {
            t.Error("IsPal returned false on palindrome,", s)
        }
    }
}

func TestNonPals(t *testing.T) {
    nps := []string{
        "no",
        "odd",
        "salàlas",
    }
    for _, s := range nps {
        if IsPal(s) {
            t.Error("IsPal returned true on non-palindrome,", s)
        }
    }
}
Task: Test a function

C: #include <assert.h>
int IsPalindrome(char *Str);

int main()
{
    assert(IsPalindrome("racecar"));
    assert(IsPalindrome("alice"));
}





Java: import static ExampleClass.pali; 
import static ExampleClass.rPali; 
import org.junit.*;
public class PalindromeTest extends junit.framework.TestCase {
    @Before
    public void setUp(){
        
        
    }
    @After
    public void tearDown(){
        
        
    }

    
    @Test
    public void testNonrecursivePali() throws Exception {
        assertTrue(pali("abcba"));
        assertTrue(pali("aa"));
        assertTrue(pali("a"));
        assertTrue(pali(""));
        assertFalse(pali("ab"));
        assertFalse(pali("abcdba"));
    }
    
    @Test
    public void testRecursivePali() throws Exception {
        assertTrue(rPali("abcba"));
        assertTrue(rPali("aa"));
        assertTrue(rPali("a"));
        assertTrue(rPali(""));
        assertFalse(rPali("ab"));
        assertFalse(rPali("abcdba"));
    }

    
    @Test(expected=WhateverException.class)
    public void except(){
        
    }
}
Task: Test a function

C: #include <assert.h>
int IsPalindrome(char *Str);

int main()
{
    assert(IsPalindrome("racecar"));
    assert(IsPalindrome("alice"));
}








VB: Option Explicit

Sub Test_a_function()
Dim a, i&
    a = Array("abba", "mom", "dennis sinned", "Un roc lamina l animal cornu", "palindrome", "ba _ ab", "racecars", "racecar", "wombat", "in girum imus nocte et consumimur igni")
    For i = 0 To UBound(a)
        Debug.Print a(i) & " is a palidrome ? " & IsPalindrome(CStr(a(i)))
    Next
End Sub

Function IsPalindrome(txt As String) As Boolean
Dim tempTxt As String
    tempTxt = LCase(Replace(txt, " ", ""))
    IsPalindrome = (tempTxt = StrReverse(tempTxt))
End Function
Task: Test a function


C++: #include <algorithm>
#include <string>

constexpr bool is_palindrome(std::string_view s)
{
  return std::equal(s.begin(), s.begin()+s.length()/2, s.rbegin());
}


C#: using Microsoft.VisualStudio.TestTools.UnitTesting;
using PalindromeDetector.ConsoleApp;

namespace PalindromeDetector.VisualStudioTests
{
    [TestClass]
    public class VSTests
    {
        [TestMethod]
        public void PalindromeDetectorCanUnderstandPalindrome()
        {
            
            bool expected = true;
            bool actual;
            actual = Program.IsPalindrome("1");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindromeNonRecursive("1");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindrome("ingirumimusnocteetconsumimurigni");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindromeNonRecursive("ingirumimusnocteetconsumimurigni");
            Assert.AreEqual(expected, actual);
        }
        [TestMethod]
        public void PalindromeDetecotryCanUnderstandNonPalindrome()
        {
            bool notExpected = true;
            bool actual = Program.IsPalindrome("ThisIsNotAPalindrome");
            Assert.AreNotEqual(notExpected, actual);
            actual = Program.IsPalindromeNonRecursive("ThisIsNotAPalindrome");
            Assert.AreNotEqual(notExpected, actual);
        }
    }
}
Task: Test a function


C++: #include <algorithm>
#include <string>

constexpr bool is_palindrome(std::string_view s)
{
  return std::equal(s.begin(), s.begin()+s.length()/2, s.rbegin());
}






Python: def is_palindrome(s):
    
    return s == s[::-1]

def _test():
    import doctest
    doctest.testmod()
    

if __name__ == "__main__":
    _test()
Task: Test a function


C++: #include <algorithm>
#include <string>

constexpr bool is_palindrome(std::string_view s)
{
  return std::equal(s.begin(), s.begin()+s.length()/2, s.rbegin());
}







VB: Option Explicit

Sub Test_a_function()
Dim a, i&
    a = Array("abba", "mom", "dennis sinned", "Un roc lamina l animal cornu", "palindrome", "ba _ ab", "racecars", "racecar", "wombat", "in girum imus nocte et consumimur igni")
    For i = 0 To UBound(a)
        Debug.Print a(i) & " is a palidrome ? " & IsPalindrome(CStr(a(i)))
    Next
End Sub

Function IsPalindrome(txt As String) As Boolean
Dim tempTxt As String
    tempTxt = LCase(Replace(txt, " ", ""))
    IsPalindrome = (tempTxt = StrReverse(tempTxt))
End Function
Task: Test a function



C#: using Microsoft.VisualStudio.TestTools.UnitTesting;
using PalindromeDetector.ConsoleApp;

namespace PalindromeDetector.VisualStudioTests
{
    [TestClass]
    public class VSTests
    {
        [TestMethod]
        public void PalindromeDetectorCanUnderstandPalindrome()
        {
            
            bool expected = true;
            bool actual;
            actual = Program.IsPalindrome("1");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindromeNonRecursive("1");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindrome("ingirumimusnocteetconsumimurigni");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindromeNonRecursive("ingirumimusnocteetconsumimurigni");
            Assert.AreEqual(expected, actual);
        }
        [TestMethod]
        public void PalindromeDetecotryCanUnderstandNonPalindrome()
        {
            bool notExpected = true;
            bool actual = Program.IsPalindrome("ThisIsNotAPalindrome");
            Assert.AreNotEqual(notExpected, actual);
            actual = Program.IsPalindromeNonRecursive("ThisIsNotAPalindrome");
            Assert.AreNotEqual(notExpected, actual);
        }
    }
}



Java: import static ExampleClass.pali; 
import static ExampleClass.rPali; 
import org.junit.*;
public class PalindromeTest extends junit.framework.TestCase {
    @Before
    public void setUp(){
        
        
    }
    @After
    public void tearDown(){
        
        
    }

    
    @Test
    public void testNonrecursivePali() throws Exception {
        assertTrue(pali("abcba"));
        assertTrue(pali("aa"));
        assertTrue(pali("a"));
        assertTrue(pali(""));
        assertFalse(pali("ab"));
        assertFalse(pali("abcdba"));
    }
    
    @Test
    public void testRecursivePali() throws Exception {
        assertTrue(rPali("abcba"));
        assertTrue(rPali("aa"));
        assertTrue(rPali("a"));
        assertTrue(rPali(""));
        assertFalse(rPali("ab"));
        assertFalse(rPali("abcdba"));
    }

    
    @Test(expected=WhateverException.class)
    public void except(){
        
    }
}
Task: Test a function




Go: package pal

import "testing"

func TestPals(t *testing.T) {
    pals := []string{
        "",
        ".",
        "11",
        "ere",
        "ingirumimusnocteetconsumimurigni",
    }
    for _, s := range pals {
        if !IsPal(s) {
            t.Error("IsPal returned false on palindrome,", s)
        }
    }
}

func TestNonPals(t *testing.T) {
    nps := []string{
        "no",
        "odd",
        "salàlas",
    }
    for _, s := range nps {
        if IsPal(s) {
            t.Error("IsPal returned true on non-palindrome,", s)
        }
    }
}


Java: import static ExampleClass.pali; 
import static ExampleClass.rPali; 
import org.junit.*;
public class PalindromeTest extends junit.framework.TestCase {
    @Before
    public void setUp(){
        
        
    }
    @After
    public void tearDown(){
        
        
    }

    
    @Test
    public void testNonrecursivePali() throws Exception {
        assertTrue(pali("abcba"));
        assertTrue(pali("aa"));
        assertTrue(pali("a"));
        assertTrue(pali(""));
        assertFalse(pali("ab"));
        assertFalse(pali("abcdba"));
    }
    
    @Test
    public void testRecursivePali() throws Exception {
        assertTrue(rPali("abcba"));
        assertTrue(rPali("aa"));
        assertTrue(rPali("a"));
        assertTrue(rPali(""));
        assertFalse(rPali("ab"));
        assertFalse(rPali("abcdba"));
    }

    
    @Test(expected=WhateverException.class)
    public void except(){
        
    }
}
Task: Test a function





Java: import static ExampleClass.pali; 
import static ExampleClass.rPali; 
import org.junit.*;
public class PalindromeTest extends junit.framework.TestCase {
    @Before
    public void setUp(){
        
        
    }
    @After
    public void tearDown(){
        
        
    }

    
    @Test
    public void testNonrecursivePali() throws Exception {
        assertTrue(pali("abcba"));
        assertTrue(pali("aa"));
        assertTrue(pali("a"));
        assertTrue(pali(""));
        assertFalse(pali("ab"));
        assertFalse(pali("abcdba"));
    }
    
    @Test
    public void testRecursivePali() throws Exception {
        assertTrue(rPali("abcba"));
        assertTrue(rPali("aa"));
        assertTrue(rPali("a"));
        assertTrue(rPali(""));
        assertFalse(rPali("ab"));
        assertFalse(rPali("abcdba"));
    }

    
    @Test(expected=WhateverException.class)
    public void except(){
        
    }
}




VB: Option Explicit

Sub Test_a_function()
Dim a, i&
    a = Array("abba", "mom", "dennis sinned", "Un roc lamina l animal cornu", "palindrome", "ba _ ab", "racecars", "racecar", "wombat", "in girum imus nocte et consumimur igni")
    For i = 0 To UBound(a)
        Debug.Print a(i) & " is a palidrome ? " & IsPalindrome(CStr(a(i)))
    Next
End Sub

Function IsPalindrome(txt As String) As Boolean
Dim tempTxt As String
    tempTxt = LCase(Replace(txt, " ", ""))
    IsPalindrome = (tempTxt = StrReverse(tempTxt))
End Function
Task: Test a function




Go: package pal

import "testing"

func TestPals(t *testing.T) {
    pals := []string{
        "",
        ".",
        "11",
        "ere",
        "ingirumimusnocteetconsumimurigni",
    }
    for _, s := range pals {
        if !IsPal(s) {
            t.Error("IsPal returned false on palindrome,", s)
        }
    }
}

func TestNonPals(t *testing.T) {
    nps := []string{
        "no",
        "odd",
        "salàlas",
    }
    for _, s := range nps {
        if IsPal(s) {
            t.Error("IsPal returned true on non-palindrome,", s)
        }
    }
}





VB: Option Explicit

Sub Test_a_function()
Dim a, i&
    a = Array("abba", "mom", "dennis sinned", "Un roc lamina l animal cornu", "palindrome", "ba _ ab", "racecars", "racecar", "wombat", "in girum imus nocte et consumimur igni")
    For i = 0 To UBound(a)
        Debug.Print a(i) & " is a palidrome ? " & IsPalindrome(CStr(a(i)))
    Next
End Sub

Function IsPalindrome(txt As String) As Boolean
Dim tempTxt As String
    tempTxt = LCase(Replace(txt, " ", ""))
    IsPalindrome = (tempTxt = StrReverse(tempTxt))
End Function
Task: Test a function

C: #include <assert.h>
int IsPalindrome(char *Str);

int main()
{
    assert(IsPalindrome("racecar"));
    assert(IsPalindrome("alice"));
}







Python: def is_palindrome(s):
    
    return s == s[::-1]

def _test():
    import doctest
    doctest.testmod()
    

if __name__ == "__main__":
    _test()
Task: Test a function


C++: #include <algorithm>
#include <string>

constexpr bool is_palindrome(std::string_view s)
{
  return std::equal(s.begin(), s.begin()+s.length()/2, s.rbegin());
}



Go: package pal

import "testing"

func TestPals(t *testing.T) {
    pals := []string{
        "",
        ".",
        "11",
        "ere",
        "ingirumimusnocteetconsumimurigni",
    }
    for _, s := range pals {
        if !IsPal(s) {
            t.Error("IsPal returned false on palindrome,", s)
        }
    }
}

func TestNonPals(t *testing.T) {
    nps := []string{
        "no",
        "odd",
        "salàlas",
    }
    for _, s := range nps {
        if IsPal(s) {
            t.Error("IsPal returned true on non-palindrome,", s)
        }
    }
}
Task: Test a function


C++: #include <algorithm>
#include <string>

constexpr bool is_palindrome(std::string_view s)
{
  return std::equal(s.begin(), s.begin()+s.length()/2, s.rbegin());
}




Java: import static ExampleClass.pali; 
import static ExampleClass.rPali; 
import org.junit.*;
public class PalindromeTest extends junit.framework.TestCase {
    @Before
    public void setUp(){
        
        
    }
    @After
    public void tearDown(){
        
        
    }

    
    @Test
    public void testNonrecursivePali() throws Exception {
        assertTrue(pali("abcba"));
        assertTrue(pali("aa"));
        assertTrue(pali("a"));
        assertTrue(pali(""));
        assertFalse(pali("ab"));
        assertFalse(pali("abcdba"));
    }
    
    @Test
    public void testRecursivePali() throws Exception {
        assertTrue(rPali("abcba"));
        assertTrue(rPali("aa"));
        assertTrue(rPali("a"));
        assertTrue(rPali(""));
        assertFalse(rPali("ab"));
        assertFalse(rPali("abcdba"));
    }

    
    @Test(expected=WhateverException.class)
    public void except(){
        
    }
}
Task: Test a function



C#: using Microsoft.VisualStudio.TestTools.UnitTesting;
using PalindromeDetector.ConsoleApp;

namespace PalindromeDetector.VisualStudioTests
{
    [TestClass]
    public class VSTests
    {
        [TestMethod]
        public void PalindromeDetectorCanUnderstandPalindrome()
        {
            
            bool expected = true;
            bool actual;
            actual = Program.IsPalindrome("1");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindromeNonRecursive("1");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindrome("ingirumimusnocteetconsumimurigni");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindromeNonRecursive("ingirumimusnocteetconsumimurigni");
            Assert.AreEqual(expected, actual);
        }
        [TestMethod]
        public void PalindromeDetecotryCanUnderstandNonPalindrome()
        {
            bool notExpected = true;
            bool actual = Program.IsPalindrome("ThisIsNotAPalindrome");
            Assert.AreNotEqual(notExpected, actual);
            actual = Program.IsPalindromeNonRecursive("ThisIsNotAPalindrome");
            Assert.AreNotEqual(notExpected, actual);
        }
    }
}


Go: package pal

import "testing"

func TestPals(t *testing.T) {
    pals := []string{
        "",
        ".",
        "11",
        "ere",
        "ingirumimusnocteetconsumimurigni",
    }
    for _, s := range pals {
        if !IsPal(s) {
            t.Error("IsPal returned false on palindrome,", s)
        }
    }
}

func TestNonPals(t *testing.T) {
    nps := []string{
        "no",
        "odd",
        "salàlas",
    }
    for _, s := range nps {
        if IsPal(s) {
            t.Error("IsPal returned true on non-palindrome,", s)
        }
    }
}
Task: Test a function







Python: def is_palindrome(s):
    
    return s == s[::-1]

def _test():
    import doctest
    doctest.testmod()
    

if __name__ == "__main__":
    _test()


VB: Option Explicit

Sub Test_a_function()
Dim a, i&
    a = Array("abba", "mom", "dennis sinned", "Un roc lamina l animal cornu", "palindrome", "ba _ ab", "racecars", "racecar", "wombat", "in girum imus nocte et consumimur igni")
    For i = 0 To UBound(a)
        Debug.Print a(i) & " is a palidrome ? " & IsPalindrome(CStr(a(i)))
    Next
End Sub

Function IsPalindrome(txt As String) As Boolean
Dim tempTxt As String
    tempTxt = LCase(Replace(txt, " ", ""))
    IsPalindrome = (tempTxt = StrReverse(tempTxt))
End Function
Task: Test a function



C#: using Microsoft.VisualStudio.TestTools.UnitTesting;
using PalindromeDetector.ConsoleApp;

namespace PalindromeDetector.VisualStudioTests
{
    [TestClass]
    public class VSTests
    {
        [TestMethod]
        public void PalindromeDetectorCanUnderstandPalindrome()
        {
            
            bool expected = true;
            bool actual;
            actual = Program.IsPalindrome("1");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindromeNonRecursive("1");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindrome("ingirumimusnocteetconsumimurigni");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindromeNonRecursive("ingirumimusnocteetconsumimurigni");
            Assert.AreEqual(expected, actual);
        }
        [TestMethod]
        public void PalindromeDetecotryCanUnderstandNonPalindrome()
        {
            bool notExpected = true;
            bool actual = Program.IsPalindrome("ThisIsNotAPalindrome");
            Assert.AreNotEqual(notExpected, actual);
            actual = Program.IsPalindromeNonRecursive("ThisIsNotAPalindrome");
            Assert.AreNotEqual(notExpected, actual);
        }
    }
}





Python: def is_palindrome(s):
    
    return s == s[::-1]

def _test():
    import doctest
    doctest.testmod()
    

if __name__ == "__main__":
    _test()
Task: Test a function



C#: using Microsoft.VisualStudio.TestTools.UnitTesting;
using PalindromeDetector.ConsoleApp;

namespace PalindromeDetector.VisualStudioTests
{
    [TestClass]
    public class VSTests
    {
        [TestMethod]
        public void PalindromeDetectorCanUnderstandPalindrome()
        {
            
            bool expected = true;
            bool actual;
            actual = Program.IsPalindrome("1");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindromeNonRecursive("1");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindrome("ingirumimusnocteetconsumimurigni");
            Assert.AreEqual(expected, actual);
            actual = Program.IsPalindromeNonRecursive("ingirumimusnocteetconsumimurigni");
            Assert.AreEqual(expected, actual);
        }
        [TestMethod]
        public void PalindromeDetecotryCanUnderstandNonPalindrome()
        {
            bool notExpected = true;
            bool actual = Program.IsPalindrome("ThisIsNotAPalindrome");
            Assert.AreNotEqual(notExpected, actual);
            actual = Program.IsPalindromeNonRecursive("ThisIsNotAPalindrome");
            Assert.AreNotEqual(notExpected, actual);
        }
    }
}






VB: Option Explicit

Sub Test_a_function()
Dim a, i&
    a = Array("abba", "mom", "dennis sinned", "Un roc lamina l animal cornu", "palindrome", "ba _ ab", "racecars", "racecar", "wombat", "in girum imus nocte et consumimur igni")
    For i = 0 To UBound(a)
        Debug.Print a(i) & " is a palidrome ? " & IsPalindrome(CStr(a(i)))
    Next
End Sub

Function IsPalindrome(txt As String) As Boolean
Dim tempTxt As String
    tempTxt = LCase(Replace(txt, " ", ""))
    IsPalindrome = (tempTxt = StrReverse(tempTxt))
End Function
Task: Test a function





Java: import static ExampleClass.pali; 
import static ExampleClass.rPali; 
import org.junit.*;
public class PalindromeTest extends junit.framework.TestCase {
    @Before
    public void setUp(){
        
        
    }
    @After
    public void tearDown(){
        
        
    }

    
    @Test
    public void testNonrecursivePali() throws Exception {
        assertTrue(pali("abcba"));
        assertTrue(pali("aa"));
        assertTrue(pali("a"));
        assertTrue(pali(""));
        assertFalse(pali("ab"));
        assertFalse(pali("abcdba"));
    }
    
    @Test
    public void testRecursivePali() throws Exception {
        assertTrue(rPali("abcba"));
        assertTrue(rPali("aa"));
        assertTrue(rPali("a"));
        assertTrue(rPali(""));
        assertFalse(rPali("ab"));
        assertFalse(rPali("abcdba"));
    }

    
    @Test(expected=WhateverException.class)
    public void except(){
        
    }
}



Python: def is_palindrome(s):
    
    return s == s[::-1]

def _test():
    import doctest
    doctest.testmod()
    

if __name__ == "__main__":
    _test()
Task: Test a function




Go: package pal

import "testing"

func TestPals(t *testing.T) {
    pals := []string{
        "",
        ".",
        "11",
        "ere",
        "ingirumimusnocteetconsumimurigni",
    }
    for _, s := range pals {
        if !IsPal(s) {
            t.Error("IsPal returned false on palindrome,", s)
        }
    }
}

func TestNonPals(t *testing.T) {
    nps := []string{
        "no",
        "odd",
        "salàlas",
    }
    for _, s := range nps {
        if IsPal(s) {
            t.Error("IsPal returned true on non-palindrome,", s)
        }
    }
}




Python: def is_palindrome(s):
    
    return s == s[::-1]

def _test():
    import doctest
    doctest.testmod()
    

if __name__ == "__main__":
    _test()