title: Even Fibonacci Numbers Sum
signature: class Solution {
  
      public Integer evenFibonacciNumbersSum(Integer limit) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer limit, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(limit,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(67, 44);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(89, 44);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(12, 10);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(94, 44);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(96, 44);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(25, 10);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(49, 44);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(8, 10);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(33, 10);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(59, 44);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer limit, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(limit),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def even_fibonacci_numbers_sum(limit):
      if (limit < 2):
          return 0
      ef1 = 0
      ef2 = 2
      sm = (ef1 + ef2)
      while (ef2 <= limit):
          ef3 = ((4 * ef2) + ef1)
          if (ef3 > limit):
              break
          ef1 = ef2
          ef2 = ef3
          sm = (sm + ef2)
      return sm
source_cpp: int even_fibonacci_numbers_sum(int limit) {
    if ( limit < 2 ) return 0;
    long long int ef1 = 0, ef2 = 2;
    long long int sum = ef1 + ef2;
    while ( ef2 <= limit ) {
      long long int ef3 = 4 * ef2 + ef1;
      if ( ef3 > limit ) break;
      ef1 = ef2;
      ef2 = ef3;
      sum += ef2;
    }
    return sum;
  }