123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- using System;
- using System.Net;
- using System.Threading;
- using System.Threading.Tasks;
- using Jint.Runtime;
- using Xunit;
- using Xunit.Extensions;
- namespace Jint.Tests.CommonScripts
- {
- public class SunSpiderTests
- {
- private Engine RunTest(string source)
- {
- var engine = new Engine()
- .SetValue("log", new Action<object>(Console.WriteLine))
- .SetValue("assert", new Action<bool>(Assert.True))
- ;
- try
- {
- engine.Execute(source);
- }
- catch (JavaScriptException je)
- {
- throw new Exception(je.ToString());
- }
- return engine;
- }
- [Theory]
- [InlineData("3d-cube", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/3d-cube.js")]
- public void ThreeDCube(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("3d-morph", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/3d-morph.js")]
- public void ThreeDMorph(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("3d-raytrace", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/3d-raytrace.js")]
- public void ThreeDRaytrace(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("access-binary-trees", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/access-binary-trees.js")]
- public void AccessBinaryTrees(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("access-fannkuch", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/access-fannkuch.js")]
- public void AccessFannkych(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("access-nbody", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/access-nbody.js")]
- public void AccessNBody(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("access-nsieve", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/access-nsieve.js")]
- public void AccessNSieve(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [InlineData("bitops-3bit-bits-in-byte", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/bitops-3bit-bits-in-byte.js")]
- public void Bitops3BitBitsInByte(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("bitops-bits-in-byte", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/bitops-bits-in-byte.js")]
- public void BitopsBitsInByte(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("bitops-bitwise-and", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/bitops-bitwise-and.js")]
- public void BitopsBitwiseAnd(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("bitops-nsieve-bits", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/bitops-nsieve-bits.js")]
- public void BitopsNSieveBits(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("controlflow-recursive", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/controlflow-recursive.js")]
- public void ControlFlowRecursive(string name, string url)
- {
- var t = new Thread(() =>
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }, 1000000000);
-
- t.Start();
- t.Join();
- }
- [Theory]
- [InlineData("crypto-aes", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/crypto-aes.js")]
- public void CryptoAES(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("crypto-md5", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/crypto-md5.js")]
- public void CryptoMD5(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [InlineData("crypto-sha1", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/crypto-sha1.js")]
- public void CryptoSha1(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("date-format-tofte", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/date-format-tofte.js")]
- public void DateFormatTofte(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("date-format-xparb", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/date-format-xparb.js")]
- public void DateFormatXParb(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [InlineData("math-cordic", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/math-cordic.js")]
- public void MathCordic(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("math-partial-sums", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/math-partial-sums.js")]
- public void MathPartialSums(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("math-spectral-norm", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/math-spectral-norm.js")]
- public void MathSpectralNorm(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("regexp-dna", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/regexp-dna.js")]
- public void RegexpDna(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("string-base64", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/string-base64.js")]
- public void StringBase64(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [InlineData("string-fasta", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/string-fasta.js")]
- public void StringFasta(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("string-tagcloud", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/string-tagcloud.js")]
- public void StringTagCloud(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("string-unpack-code", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/string-unpack-code.js")]
- public void StringUnpackCode(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- [Theory]
- [InlineData("string-validate-input", "https://raw.github.com/WebKit/webkit/master/PerformanceTests/SunSpider/tests/sunspider-1.0.1/string-validate-input.js")]
- public void StringValidateInput(string name, string url)
- {
- var content = new WebClient().DownloadString(url);
- RunTest(content);
- }
- }
- }
|