Skip to content

Instantly share code, notes, and snippets.

@0xJchen
Created September 27, 2023 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xJchen/cd485032f9ff1ef5105519d319d471fb to your computer and use it in GitHub Desktop.
Save 0xJchen/cd485032f9ff1ef5105519d319d471fb to your computer and use it in GitHub Desktop.
sample test cases
# evosuite
/*
* This file was automatically generated by EvoSuite
* Fri Sep 22 05:18:32 GMT 2023
*/
package org.jsoup.nodes;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.jsoup.nodes.Attribute;
import org.jsoup.nodes.Attributes;
import org.jsoup.nodes.Document;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true)
public class Attribute_ESTest extends Attribute_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
Attribute attribute0 = Attribute.createFromEncoded("b9pI;7$f.Es7", "b9pI;7$f.Es7");
attribute0.hashCode();
}
@Test(timeout = 4000)
public void test01() throws Throwable {
Attribute attribute0 = new Attribute("llM`#<", (String) null, (Attributes) null);
Attribute attribute1 = Attribute.createFromEncoded("llM`#<", "H)mjqC2_TWx2");
boolean boolean0 = attribute0.equals(attribute1);
// // Unstable assertion: assertTrue(attribute1.equals((Object)attribute0));
// // Unstable assertion: assertFalse(boolean0);
// // Unstable assertion: assertEquals("H)mjqC2_TWx2", attribute1.getValue());
}
@Test(timeout = 4000)
public void test02() throws Throwable {
Attribute attribute0 = Attribute.createFromEncoded("b9pI;7$f.Es7", "b9pI;7$f.Es7");
Attribute attribute1 = Attribute.createFromEncoded("b9pI;7$f.Es7", "data-~w5x3SVo\"MKtw5xr?");
boolean boolean0 = attribute0.equals(attribute1);
assertFalse(boolean0);
assertEquals("b9pI;7$f.Es7", attribute1.getKey());
}
@Test(timeout = 4000)
public void test03() throws Throwable {
Attributes attributes0 = new Attributes();
Attribute attribute0 = new Attribute("1K6,BPkVv", "[1@Q", attributes0);
Attribute attribute1 = new Attribute("g z27", "1K6,BPkVv", attributes0);
boolean boolean0 = attribute0.equals(attribute1);
assertEquals("1K6,BPkVv", attribute1.getValue());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test04() throws Throwable {
Attribute attribute0 = Attribute.createFromEncoded("&Vm19uK$", "[%s=%s]");
boolean boolean0 = attribute0.equals((Object) null);
assertEquals("[%s=%s]", attribute0.getValue());
assertEquals("&Vm19uK$", attribute0.getKey());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test05() throws Throwable {
Attribute attribute0 = new Attribute("llM`#<", (String) null, (Attributes) null);
boolean boolean0 = attribute0.equals(attribute0);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test06() throws Throwable {
Attribute attribute0 = new Attribute("llM`#<", (String) null, (Attributes) null);
Object object0 = new Object();
boolean boolean0 = attribute0.equals(object0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test07() throws Throwable {
Attribute attribute0 = Attribute.createFromEncoded("b9pI;7$f.Es7", "b9pI;7$f.Es7");
boolean boolean0 = attribute0.isBooleanAttribute();
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test08() throws Throwable {
Attribute attribute0 = new Attribute("llM`#<", (String) null, (Attributes) null);
boolean boolean0 = attribute0.isBooleanAttribute();
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test09() throws Throwable {
Attribute attribute0 = new Attribute("open", "");
boolean boolean0 = attribute0.isBooleanAttribute();
assertEquals("", attribute0.getValue());
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test10() throws Throwable {
Attribute attribute0 = Attribute.createFromEncoded("{A\"g\u0000g'Zt!", "{A\"g\u0000g'Zt!");
String string0 = attribute0.toString();
assertEquals("{A\"g\u0000g'Zt!=\"{A&quot;g\u0000g'Zt!\"", string0);
}
@Test(timeout = 4000)
public void test11() throws Throwable {
Attribute attribute0 = new Attribute("open", "");
String string0 = attribute0.html();
assertEquals("", attribute0.getValue());
assertEquals("open", string0);
}
@Test(timeout = 4000)
public void test12() throws Throwable {
Document.OutputSettings document_OutputSettings0 = new Document.OutputSettings();
Document.OutputSettings.Syntax document_OutputSettings_Syntax0 = Document.OutputSettings.Syntax.xml;
Document.OutputSettings document_OutputSettings1 = document_OutputSettings0.syntax(document_OutputSettings_Syntax0);
boolean boolean0 = Attribute.shouldCollapseAttribute(";}aFA;!L#xtu3V", ";}aFA;!L#xtu3V", document_OutputSettings1);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test13() throws Throwable {
Attributes attributes0 = new Attributes();
Attribute attribute0 = new Attribute("truespeed", "truespeed", attributes0);
attribute0.setKey("data-");
boolean boolean0 = attribute0.isDataAttribute();
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test14() throws Throwable {
boolean boolean0 = Attribute.isDataAttribute("data-~w5x3SVo\"MKtw5xr?");
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test15() throws Throwable {
Attribute attribute0 = new Attribute(".", "f.PiH&%#1fzr");
String string0 = attribute0.toString();
assertEquals(".=\"f.PiH&amp;%#1fzr\"", string0);
}
@Test(timeout = 4000)
public void test16() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.put("ascii", "");
Attribute attribute0 = new Attribute("ascii", "", attributes0);
String string0 = attribute0.setValue("");
assertEquals("", string0);
}
@Test(timeout = 4000)
public void test17() throws Throwable {
Attributes attributes0 = new Attributes();
Attribute attribute0 = new Attribute("1K6,BPkVv", "[1@Q", attributes0);
attribute0.setValue("Van");
assertEquals("Van", attribute0.getValue());
}
@Test(timeout = 4000)
public void test18() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("truespeed", "data-");
Attribute attribute0 = new Attribute("truespeed", "truespeed", attributes1);
attribute0.setKey("data-");
assertEquals("data-", attribute0.getKey());
}
@Test(timeout = 4000)
public void test19() throws Throwable {
Attribute attribute0 = new Attribute("open", "");
attribute0.setKey("open");
assertEquals("", attribute0.getValue());
}
@Test(timeout = 4000)
public void test20() throws Throwable {
Attribute attribute0 = new Attribute(".", "f.PiH&%#1fzr");
// Undeclared exception!
try {
attribute0.shouldCollapseAttribute((Document.OutputSettings) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.jsoup.nodes.Attribute", e);
}
}
@Test(timeout = 4000)
public void test21() throws Throwable {
Attribute attribute0 = new Attribute("llM`#<", (String) null, (Attributes) null);
Attribute attribute1 = attribute0.clone();
boolean boolean0 = attribute0.equals(attribute1);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test22() throws Throwable {
Attributes attributes0 = new Attributes();
Attribute attribute0 = new Attribute("truespeed", "truespeed", attributes0);
boolean boolean0 = attribute0.isDataAttribute();
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test23() throws Throwable {
Attributes attributes0 = new Attributes();
Attribute attribute0 = Attribute.createFromEncoded("&Vm19uK$", "[%s=%s]");
attributes0.put(attribute0);
String string0 = attribute0.setValue((String) null);
assertNotNull(string0);
assertEquals("[%s=%s]", string0);
attribute0.hashCode();
assertEquals("&Vm19uK$", attribute0.getKey());
}
@Test(timeout = 4000)
public void test24() throws Throwable {
Attribute attribute0 = new Attribute("llM`#<", (String) null, (Attributes) null);
attribute0.toString();
}
}
# human
package org.jsoup.nodes;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class AttributeTest {
@Test public void html() {
Attribute attr = new Attribute("key", "value &");
assertEquals("key=\"value &amp;\"", attr.html());
assertEquals(attr.html(), attr.toString());
}
@Test public void testWithSupplementaryCharacterInAttributeKeyAndValue() {
String s = new String(Character.toChars(135361));
Attribute attr = new Attribute(s, "A" + s + "B");
assertEquals(s + "=\"A" + s + "B\"", attr.html());
assertEquals(attr.html(), attr.toString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment