<commit_before># This code is free software; you can redistribute it and/or modify it under the
# terms of the new BSD License.
#
# Copyright (c) 2008, <NAME>
#
# $Id$

$:.push File.join(File.dirname(__FILE__), "../lib")

require "ipaddr"
require "steam/servers/goldsrc_server"
require "steam/servers/source_server"
require "test/unit"

class RCONTests < Test::Unit::TestCase
  
  # This test tries to run the "status" command over RCON on a GoldSrc server
  def test_long_rcon_goldsrc_server
    assert_nothing_raised do
      server = GoldSrcServer.new IPAddr.new("127.0.0.1")
      server.rcon_auth "test"
      rcon_reply = server.rcon_exec "cvarlist"
      print "#{rcon_reply}\n"

      assert(
        rcon_reply.include?("CvarList ? for syntax"),
        "Did not receive complete cvarlist.")
    end
  end
  
  # This test tries to run the "status" command over RCON on a Source server
  def test_long_rcon_source_server
    assert_nothing_raised do
      server = SourceServer.new IPAddr.new("127.0.0.1")
      if server.rcon_auth "test"
        rcon_reply = server.rcon_exec "cvarlist"
        print "#{rcon_reply}\n"
      end
    end
  end

  # This test tries to run the "status" command over RCON on a GoldSrc server
  def test_short_rcon_goldsrc_server
    assert_nothing_raised do
      server = GoldSrcServer.new IPAddr.new("127.0.0.1")
      server.rcon_auth "test"
      rcon_reply = server.rcon_exec "version"
      print "#{rcon_reply}\n"

      assert(
        rcon_reply.include?("Protocol version") &&
        rcon_reply.include?("Exe version") &&
        rcon_reply.include?("Exe build"),
        "Did not receive correct version response.");
    end
  end
  
  # This test tries to run the "status" command over RCON on a Source server
  def test_short_rcon_source_server
    assert_nothing_raised do
      server = SourceServer.new IPAddr.new("127.0.0.1")
      if server.rcon_auth "test"
        rcon_reply = server.rcon_exec "version"
        print "#{rcon_reply}\n"
      end
    end
  end

end<commit_msg> * Java:    * Fixed reading of packet size in RCONSocket.receivePacket()  * Java / PHP / Ruby:    * Added assertions for Source RCON tests<commit_after># This code is free software; you can redistribute it and/or modify it under the
# terms of the new BSD License.
#
# Copyright (c) 2008-2009, <NAME>
#
# $Id$

$:.push File.join(File.dirname(__FILE__), "../lib")

require "ipaddr"
require "steam/servers/goldsrc_server"
require "steam/servers/source_server"
require "test/unit"

class RCONTests < Test::Unit::TestCase
  
  # This test tries to run the "status" command over RCON on a GoldSrc server
  def test_long_rcon_goldsrc_server
    assert_nothing_raised do
      server = GoldSrcServer.new IPAddr.new("127.0.0.1")
      server.rcon_auth "test"
      rcon_reply = server.rcon_exec "cvarlist"
      print "#{rcon_reply}\n"

      assert(
        rcon_reply.include?("CvarList ? for syntax"),
        "Did not receive complete cvarlist.")
    end
  end
  
  # This test tries to run the "status" command over RCON on a Source server
  def test_long_rcon_source_server
    assert_nothing_raised do
      server = SourceServer.new IPAddr.new("127.0.0.1")
      if server.rcon_auth "test"
        rcon_reply = server.rcon_exec "cvarlist"
        print "#{rcon_reply}\n"
      end

      assert(
        rcon_reply.include?("total convars/concommands"),
        "Did not receive complete cvarlist.")
    end
  end

  # This test tries to run the "status" command over RCON on a GoldSrc server
  def test_short_rcon_goldsrc_server
    assert_nothing_raised do
      server = GoldSrcServer.new IPAddr.new("127.0.0.1")
      server.rcon_auth "test"
      rcon_reply = server.rcon_exec "version"
      print "#{rcon_reply}\n"

      assert(
        rcon_reply.include?("Protocol version") &&
        rcon_reply.include?("Exe version") &&
        rcon_reply.include?("Exe build"),
        "Did not receive correct version response.");
    end
  end
  
  # This test tries to run the "status" command over RCON on a Source server
  def test_short_rcon_source_server
    assert_nothing_raised do
      server = SourceServer.new IPAddr.new("127.0.0.1")
      if server.rcon_auth "<PASSWORD>"
        rcon_reply = server.rcon_exec "version"
        print "#{rcon_reply}\n"
      end

      assert(
        rcon_reply.include?("Protocol version") &&
        rcon_reply.include?("Exe version") &&
        rcon_reply.include?("Exe build"),
        "Did not receive correct version response.");
    end
  end

end
{'fraction_non_alphanumeric': 0.09962530306369848, 'fraction_numerical': 0.013224597751818383, 'mean_word_length': 2.9841966637401227, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3469396', 'n_tokens_mistral': 1520, 'n_tokens_neox': 1474, 'n_words': 411}