diff --git a/.gitignore b/.gitignore
index 5dbe0165c..3f7ff7b7b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -93,3 +93,4 @@ Builds/VisualStudio2015/*.sdf
# MSVC
*.pdb
+.vs/
diff --git a/Builds/VisualStudio2015/RippleD.vcxproj b/Builds/VisualStudio2015/RippleD.vcxproj
index a21d354c8..a4452a05e 100644
--- a/Builds/VisualStudio2015/RippleD.vcxproj
+++ b/Builds/VisualStudio2015/RippleD.vcxproj
@@ -4386,6 +4386,10 @@
True
True
+
+ True
+ True
+
True
True
diff --git a/Builds/VisualStudio2015/RippleD.vcxproj.filters b/Builds/VisualStudio2015/RippleD.vcxproj.filters
index d37cd0fca..8fce5671c 100644
--- a/Builds/VisualStudio2015/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2015/RippleD.vcxproj.filters
@@ -5193,6 +5193,9 @@
test\app
+
+ test\app
+
test\app
diff --git a/src/test/app/SetTrust_test.cpp b/src/test/app/SetTrust_test.cpp
new file mode 100644
index 000000000..eae173dd0
--- /dev/null
+++ b/src/test/app/SetTrust_test.cpp
@@ -0,0 +1,68 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of rippled: https://github.com/ripple/rippled
+ Copyright (c) 2012-2016 Ripple Labs Inc.
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+#include
+
+namespace ripple {
+namespace test {
+
+class SetTrust_test : public beast::unit_test::suite
+{
+public:
+ void testFreeTrustlines()
+ {
+ testcase("Allow 2 free trust lines before requiring reserve");
+
+ using namespace jtx;
+ Env env(*this);
+
+ auto const gwA = Account{ "gatewayA" };
+ auto const gwB = Account{ "gatewayB" };
+ auto const gwC = Account{ "gatewayC" };
+ auto const alice = Account{ "alice" };
+
+ auto const txFee = env.current()->fees().base;
+ auto const baseReserve = env.current()->fees().accountReserve(0);
+ auto const threelineReserve = env.current()->fees().accountReserve(3);
+
+ env.fund(XRP(10000), gwA, gwB, gwC);
+
+ // Fund alice with ...
+ env.fund(baseReserve /* enough to hold an account */
+ + drops(3*txFee) /* and to pay for 3 transactions */, alice);
+
+ env(trust(alice, gwA["USD"](100)), require(lines(alice,1)));
+ env(trust(alice, gwB["USD"](100)), require(lines(alice,2)));
+
+ // Alice does not have enough for the third trust line
+ env(trust(alice, gwC["USD"](100)), ter(tecNO_LINE_INSUF_RESERVE), require(lines(alice,2)));
+
+ // Fund Alice additional amount to cover
+ env(pay(env.master, alice, STAmount{ threelineReserve - baseReserve }));
+ env(trust(alice, gwC["USD"](100)), require(lines(alice,3)));
+ }
+
+
+ void run()
+ {
+ testFreeTrustlines();
+ }
+};
+BEAST_DEFINE_TESTSUITE(SetTrust, app, ripple);
+} // test
+} // ripple
diff --git a/src/unity/app_test_unity.cpp b/src/unity/app_test_unity.cpp
index 4b4c56be8..fc8f417e0 100644
--- a/src/unity/app_test_unity.cpp
+++ b/src/unity/app_test_unity.cpp
@@ -39,4 +39,5 @@
#include
#include
#include
-#include
\ No newline at end of file
+#include
+#include