Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 16cdeda

Browse files
committed
Fix whitespace
1 parent ca4a049 commit 16cdeda

File tree

96 files changed

+7013
-6999
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+7013
-6999
lines changed

tests/ServiceStack.Redis.Tests/AdhocClientTests.cs

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@
66

77
namespace ServiceStack.Redis.Tests
88
{
9-
[TestFixture, Category("Integration")]
10-
public class AdhocClientTests
11-
{
12-
[Test]
13-
public void Search_Test()
14-
{
15-
using (var client = new RedisClient(TestConfig.SingleHost))
16-
{
17-
const string cacheKey = "urn+metadata:All:SearchProProfiles?SwanShinichi Osawa /0/8,0,0,0";
18-
const long value = 1L;
19-
client.Set(cacheKey, value);
20-
var result = client.Get<long>(cacheKey);
21-
22-
Assert.That(result, Is.EqualTo(value));
23-
}
24-
}
9+
[TestFixture, Category("Integration")]
10+
public class AdhocClientTests
11+
{
12+
[Test]
13+
public void Search_Test()
14+
{
15+
using (var client = new RedisClient(TestConfig.SingleHost))
16+
{
17+
const string cacheKey = "urn+metadata:All:SearchProProfiles?SwanShinichi Osawa /0/8,0,0,0";
18+
const long value = 1L;
19+
client.Set(cacheKey, value);
20+
var result = client.Get<long>(cacheKey);
21+
22+
Assert.That(result, Is.EqualTo(value));
23+
}
24+
}
2525

2626
public string CalculateMD5Hash(string input)
2727
{
2828
// step 1, calculate MD5 hash from input
2929
var md5 = MD5.Create();
3030
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
3131
byte[] hash = md5.ComputeHash(inputBytes);
32-
32+
3333
// step 2, convert byte array to hex string
3434
var sb = new StringBuilder();
3535
for (int i = 0; i < hash.Length; i++)
@@ -39,69 +39,69 @@ public string CalculateMD5Hash(string input)
3939
return sb.ToString();
4040
}
4141

42-
[Test]
43-
public void Can_infer_utf8_bytes()
44-
{
45-
var cmd = "GET" + 2 + "\r\n";
46-
var cmdBytes = System.Text.Encoding.UTF8.GetBytes(cmd);
42+
[Test]
43+
public void Can_infer_utf8_bytes()
44+
{
45+
var cmd = "GET" + 2 + "\r\n";
46+
var cmdBytes = System.Text.Encoding.UTF8.GetBytes(cmd);
4747

48-
var hex = BitConverter.ToString(cmdBytes);
48+
var hex = BitConverter.ToString(cmdBytes);
4949

50-
Debug.WriteLine(hex);
50+
Debug.WriteLine(hex);
5151

52-
Debug.WriteLine(BitConverter.ToString("G".ToUtf8Bytes()));
53-
Debug.WriteLine(BitConverter.ToString("E".ToUtf8Bytes()));
54-
Debug.WriteLine(BitConverter.ToString("T".ToUtf8Bytes()));
55-
Debug.WriteLine(BitConverter.ToString("2".ToUtf8Bytes()));
56-
Debug.WriteLine(BitConverter.ToString("\r".ToUtf8Bytes()));
57-
Debug.WriteLine(BitConverter.ToString("\n".ToUtf8Bytes()));
52+
Debug.WriteLine(BitConverter.ToString("G".ToUtf8Bytes()));
53+
Debug.WriteLine(BitConverter.ToString("E".ToUtf8Bytes()));
54+
Debug.WriteLine(BitConverter.ToString("T".ToUtf8Bytes()));
55+
Debug.WriteLine(BitConverter.ToString("2".ToUtf8Bytes()));
56+
Debug.WriteLine(BitConverter.ToString("\r".ToUtf8Bytes()));
57+
Debug.WriteLine(BitConverter.ToString("\n".ToUtf8Bytes()));
5858

59-
var bytes = new[] { (byte)'\r', (byte)'\n', (byte)'0', (byte)'9', };
60-
Debug.WriteLine(BitConverter.ToString(bytes));
61-
}
59+
var bytes = new[] { (byte)'\r', (byte)'\n', (byte)'0', (byte)'9', };
60+
Debug.WriteLine(BitConverter.ToString(bytes));
61+
}
6262

63-
[Test]
64-
public void Convert_int()
65-
{
66-
var test = 1234;
67-
Debug.WriteLine(BitConverter.ToString(1234.ToString().ToUtf8Bytes()));
68-
}
63+
[Test]
64+
public void Convert_int()
65+
{
66+
var test = 1234;
67+
Debug.WriteLine(BitConverter.ToString(1234.ToString().ToUtf8Bytes()));
68+
}
6969

70-
private static byte[] GetCmdBytes1(char cmdPrefix, int noOfLines)
71-
{
72-
var cmd = cmdPrefix.ToString() + noOfLines.ToString() + "\r\n";
73-
return cmd.ToUtf8Bytes();
74-
}
70+
private static byte[] GetCmdBytes1(char cmdPrefix, int noOfLines)
71+
{
72+
var cmd = cmdPrefix.ToString() + noOfLines.ToString() + "\r\n";
73+
return cmd.ToUtf8Bytes();
74+
}
7575

76-
private static byte[] GetCmdBytes2(char cmdPrefix, int noOfLines)
77-
{
78-
var strLines = noOfLines.ToString();
79-
var cmdBytes = new byte[1 + strLines.Length + 2];
80-
cmdBytes[0] = (byte)cmdPrefix;
76+
private static byte[] GetCmdBytes2(char cmdPrefix, int noOfLines)
77+
{
78+
var strLines = noOfLines.ToString();
79+
var cmdBytes = new byte[1 + strLines.Length + 2];
80+
cmdBytes[0] = (byte)cmdPrefix;
8181

82-
for (var i = 0; i < strLines.Length; i++)
83-
cmdBytes[i + 1] = (byte)strLines[i];
82+
for (var i = 0; i < strLines.Length; i++)
83+
cmdBytes[i + 1] = (byte)strLines[i];
8484

85-
cmdBytes[cmdBytes.Length - 2] = 0x0D; // \r
86-
cmdBytes[cmdBytes.Length - 1] = 0x0A; // \n
85+
cmdBytes[cmdBytes.Length - 2] = 0x0D; // \r
86+
cmdBytes[cmdBytes.Length - 1] = 0x0A; // \n
8787

88-
return cmdBytes;
89-
}
88+
return cmdBytes;
89+
}
9090

91-
[Test]
92-
public void Compare_GetCmdBytes()
93-
{
94-
var res1 = GetCmdBytes1('$', 1234);
95-
var res2 = GetCmdBytes2('$', 1234);
91+
[Test]
92+
public void Compare_GetCmdBytes()
93+
{
94+
var res1 = GetCmdBytes1('$', 1234);
95+
var res2 = GetCmdBytes2('$', 1234);
9696

97-
Debug.WriteLine(BitConverter.ToString(res1));
98-
Debug.WriteLine(BitConverter.ToString(res2));
97+
Debug.WriteLine(BitConverter.ToString(res1));
98+
Debug.WriteLine(BitConverter.ToString(res2));
9999

100-
var ticks1 = PerfUtils.Measure(() => GetCmdBytes1('$', 2));
101-
var ticks2 = PerfUtils.Measure(() => GetCmdBytes2('$', 2));
100+
var ticks1 = PerfUtils.Measure(() => GetCmdBytes1('$', 2));
101+
var ticks2 = PerfUtils.Measure(() => GetCmdBytes2('$', 2));
102102

103-
Debug.WriteLine(String.Format("{0} : {1} = {2}", ticks1, ticks2, ticks1 / (double)ticks2));
104-
}
103+
Debug.WriteLine(String.Format("{0} : {1} = {2}", ticks1, ticks2, ticks1 / (double)ticks2));
104+
}
105105

106-
}
106+
}
107107
}

tests/ServiceStack.Redis.Tests/Benchmarks/DoubleSerializationBenchmarks.cs

Lines changed: 88 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -8,92 +8,92 @@
88

99
namespace ServiceStack.Redis.Tests.Benchmarks
1010
{
11-
[TestFixture, Explicit]
12-
public class DoubleSerializationBenchmarks
13-
{
14-
const int times = 100000;
15-
16-
public void ResetGC()
17-
{
18-
GC.Collect();
19-
GC.WaitForPendingFinalizers();
20-
GC.Collect();
21-
}
22-
23-
[Test]
24-
public void Compare_double_serializers()
25-
{
26-
var initalVal = 0.3333333333333333d;
27-
28-
var results = new string[times];
29-
30-
ResetGC();
31-
var sw = Stopwatch.StartNew();
32-
33-
for (var i = 0; i < times; i++)
34-
{
35-
results[i] = (initalVal + i).ToString();
36-
}
37-
38-
Debug.WriteLine("double.ToString(): Completed in ms: " + sw.ElapsedMilliseconds);
39-
//PrintLastValues(results, 100);
40-
41-
ResetGC();
42-
sw = Stopwatch.StartNew();
43-
44-
for (var i = 0; i < times; i++)
45-
{
46-
results[i] = (initalVal + i).ToString("r");
47-
}
48-
49-
Debug.WriteLine("double.ToString('r') completed in ms: " + sw.ElapsedMilliseconds);
50-
//PrintLastValues(results, 100);
51-
52-
//Default
53-
ResetGC();
54-
sw = Stopwatch.StartNew();
55-
56-
for (var i = 0; i < times; i++)
57-
{
58-
results[i] = DoubleConverter.ToExactString(initalVal + i);
59-
}
60-
61-
Debug.WriteLine("DoubleConverter.ToExactString(): Completed in ms: " + sw.ElapsedMilliseconds);
62-
//PrintLastValues(results, 100);
63-
64-
//What #XBOX uses
65-
ResetGC();
66-
sw = Stopwatch.StartNew();
67-
68-
for (var i = 0; i < times; i++)
69-
{
70-
results[i] = BitConverter.ToString(BitConverter.GetBytes(initalVal + i));
71-
}
72-
73-
Debug.WriteLine("BitConverter.ToString() completed in ms: " + sw.ElapsedMilliseconds);
74-
//PrintLastValues(results, 100);
75-
76-
77-
//What Booksleeve uses
78-
ResetGC();
79-
sw = Stopwatch.StartNew();
80-
81-
for (var i = 0; i < times; i++)
82-
{
83-
results[i] = (initalVal + i).ToString("G", CultureInfo.InvariantCulture);
84-
}
85-
86-
Debug.WriteLine("double.ToString('G') completed in ms: " + sw.ElapsedMilliseconds);
87-
//PrintLastValues(results, 100);
88-
}
89-
90-
private static void PrintLastValues(string[] results, int count)
91-
{
92-
var sb = new StringBuilder();
93-
for (int i = times - 1; i >= (times - count); i--)
94-
sb.AppendLine(results[i]);
95-
Debug.WriteLine("Last {0} values: ".Fmt(count));
96-
Debug.WriteLine(sb);
97-
}
98-
}
11+
[TestFixture, Explicit]
12+
public class DoubleSerializationBenchmarks
13+
{
14+
const int times = 100000;
15+
16+
public void ResetGC()
17+
{
18+
GC.Collect();
19+
GC.WaitForPendingFinalizers();
20+
GC.Collect();
21+
}
22+
23+
[Test]
24+
public void Compare_double_serializers()
25+
{
26+
var initalVal = 0.3333333333333333d;
27+
28+
var results = new string[times];
29+
30+
ResetGC();
31+
var sw = Stopwatch.StartNew();
32+
33+
for (var i = 0; i < times; i++)
34+
{
35+
results[i] = (initalVal + i).ToString();
36+
}
37+
38+
Debug.WriteLine("double.ToString(): Completed in ms: " + sw.ElapsedMilliseconds);
39+
//PrintLastValues(results, 100);
40+
41+
ResetGC();
42+
sw = Stopwatch.StartNew();
43+
44+
for (var i = 0; i < times; i++)
45+
{
46+
results[i] = (initalVal + i).ToString("r");
47+
}
48+
49+
Debug.WriteLine("double.ToString('r') completed in ms: " + sw.ElapsedMilliseconds);
50+
//PrintLastValues(results, 100);
51+
52+
//Default
53+
ResetGC();
54+
sw = Stopwatch.StartNew();
55+
56+
for (var i = 0; i < times; i++)
57+
{
58+
results[i] = DoubleConverter.ToExactString(initalVal + i);
59+
}
60+
61+
Debug.WriteLine("DoubleConverter.ToExactString(): Completed in ms: " + sw.ElapsedMilliseconds);
62+
//PrintLastValues(results, 100);
63+
64+
//What #XBOX uses
65+
ResetGC();
66+
sw = Stopwatch.StartNew();
67+
68+
for (var i = 0; i < times; i++)
69+
{
70+
results[i] = BitConverter.ToString(BitConverter.GetBytes(initalVal + i));
71+
}
72+
73+
Debug.WriteLine("BitConverter.ToString() completed in ms: " + sw.ElapsedMilliseconds);
74+
//PrintLastValues(results, 100);
75+
76+
77+
//What Booksleeve uses
78+
ResetGC();
79+
sw = Stopwatch.StartNew();
80+
81+
for (var i = 0; i < times; i++)
82+
{
83+
results[i] = (initalVal + i).ToString("G", CultureInfo.InvariantCulture);
84+
}
85+
86+
Debug.WriteLine("double.ToString('G') completed in ms: " + sw.ElapsedMilliseconds);
87+
//PrintLastValues(results, 100);
88+
}
89+
90+
private static void PrintLastValues(string[] results, int count)
91+
{
92+
var sb = new StringBuilder();
93+
for (int i = times - 1; i >= (times - count); i--)
94+
sb.AppendLine(results[i]);
95+
Debug.WriteLine("Last {0} values: ".Fmt(count));
96+
Debug.WriteLine(sb);
97+
}
98+
}
9999
}

tests/ServiceStack.Redis.Tests/ConfigTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void Does_handle_different_connection_strings_settings(string connString,
3636
var actual = connString.ToRedisEndpoint();
3737
var expected = expectedJsv.FromJsv<RedisEndpoint>();
3838

39-
Assert.That(actual, Is.EqualTo(expected),
39+
Assert.That(actual, Is.EqualTo(expected),
4040
"{0} != {1}".Fmt(actual.ToJsv(), expected.ToJsv()));
4141
}
4242

@@ -83,14 +83,14 @@ public void Does_set_all_properties_on_Client_using_ClientsManagers()
8383

8484
private static void AssertClientManager(IRedisClientsManager redisManager, RedisEndpoint expected)
8585
{
86-
using (var readWrite = (RedisClient) redisManager.GetClient())
87-
using (var readOnly = (RedisClient) redisManager.GetReadOnlyClient())
88-
using (var cacheClientWrapper = (RedisClientManagerCacheClient) redisManager.GetCacheClient())
86+
using (var readWrite = (RedisClient)redisManager.GetClient())
87+
using (var readOnly = (RedisClient)redisManager.GetReadOnlyClient())
88+
using (var cacheClientWrapper = (RedisClientManagerCacheClient)redisManager.GetCacheClient())
8989
{
9090
AssertClient(readWrite, expected);
9191
AssertClient(readOnly, expected);
9292

93-
using (var cacheClient = (RedisClient) cacheClientWrapper.GetClient())
93+
using (var cacheClient = (RedisClient)cacheClientWrapper.GetClient())
9494
{
9595
AssertClient(cacheClient, expected);
9696
}

0 commit comments

Comments
 (0)