示例#1
0
        public void TestllListFindList()
        {
            TestHelpers.InMethod();

            LSL_List src = new LSL_List(new LSL_Integer(1), new LSL_Integer(2), new LSL_Integer(3));

            {
                // Test for a single item that should be found
                int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_Integer(4)));
                Assert.That(result, Is.EqualTo(-1));
            }

            {
                // Test for a single item that should be found
                int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_Integer(2)));
                Assert.That(result, Is.EqualTo(1));
            }

            {
                // Test for a constant that should be found
                int result = m_lslApi.llListFindList(src, new LSL_List(ScriptBaseClass.AGENT));
                Assert.That(result, Is.EqualTo(0));
            }

            {
                // Test for a list that should be found
                int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_Integer(2), new LSL_Integer(3)));
                Assert.That(result, Is.EqualTo(1));
            }

            {
                // Test for a single item not in the list
                int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_Integer(4)));
                Assert.That(result, Is.EqualTo(-1));
            }

            {
                // Test for something that should not be cast
                int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_String("4")));
                Assert.That(result, Is.EqualTo(-1));
            }

            {
                // Test for a list not in the list
                int result
                    = m_lslApi.llListFindList(
                          src, new LSL_List(new LSL_Integer(2), new LSL_Integer(3), new LSL_Integer(4)));
                Assert.That(result, Is.EqualTo(-1));
            }

            {
                LSL_List srcWithConstants
                    = new LSL_List(new LSL_Integer(3), ScriptBaseClass.AGENT, ScriptBaseClass.OS_NPC_LAND_AT_TARGET);

                // Test for constants that appears in the source list that should be found
                int result
                    = m_lslApi.llListFindList(srcWithConstants, new LSL_List(new LSL_Integer(1), new LSL_Integer(2)));

                Assert.That(result, Is.EqualTo(1));
            }
        }