title: Swap Two Nibbles Byte
signature: fun swapTwoNibblesByte(x: Int): Int {
source_py: def swap_two_nibbles_byte(x):
      return (((x & 15) << 4) | ((x & 240) >> 4))
source_cpp: int swap_two_nibbles_byte(int x) {
    return ( ( x & 0x0F ) << 4 | ( x & 0xF0 ) >> 4 );
  }
question_info.test_list: [{"idx": 0, "outputs": 147, "inputs": {"x": 57}}, {"idx": 1, "outputs": 54, "inputs": {"x": 99}}, {"idx": 2, "outputs": 36, "inputs": {"x": 66}}, {"idx": 3, "outputs": 22, "inputs": {"x": 97}}, {"idx": 4, "outputs": 245, "inputs": {"x": 95}}, {"idx": 5, "outputs": 162, "inputs": {"x": 42}}, {"idx": 6, "outputs": 245, "inputs": {"x": 95}}, {"idx": 7, "outputs": 149, "inputs": {"x": 89}}, {"idx": 8, "outputs": 48, "inputs": {"x": 3}}, {"idx": 9, "outputs": 69, "inputs": {"x": 84}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(x: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(x), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(57, 147)
      println("TEST-0...${result}")
      
      result = driver(99, 54)
      println("TEST-1...${result}")
      
      result = driver(66, 36)
      println("TEST-2...${result}")
      
      result = driver(97, 22)
      println("TEST-3...${result}")
      
      result = driver(95, 245)
      println("TEST-4...${result}")
      
      result = driver(42, 162)
      println("TEST-5...${result}")
      
      result = driver(95, 245)
      println("TEST-6...${result}")
      
      result = driver(89, 149)
      println("TEST-7...${result}")
      
      result = driver(3, 48)
      println("TEST-8...${result}")
      
      result = driver(84, 69)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: swapTwoNibblesByte
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn